[workaround] Frontend schedule to display in local timezone for a worldwide station?
  • Is this possible in the Frontend? It is possible in the Backend.

    I guess I am hoping there may be some simple was to pass the utc time offset in the call for Week Info or interval.?



    Post edited by John Chewter at 2013-09-09 06:50:07
    No longer using Airtime or Libretime.
  • 19 Comments sorted by
  • Halfway-house workaround..

    This is the key new code on the weekly For Loop. This goes just below for (var j=0; j<daySchedule.length; j++){

                        var jStartT = daySchedule[j].start_timestamp+' UTC';
                        var jNewStartDate=jStartT.replace(/-/gi,"/");
                        var jLocalStartTime = new Date(jNewStartDate);
                        var jLocalSchedStart = ('0' + jLocalStartTime.getHours()).slice(-2)+':'+('0' + jLocalStartTime.getMinutes()).slice(-2);
                        var jEndT = daySchedule[j].end_timestamp+' UTC';
                        var jNewEndDate=jEndT.replace(/-/gi,"/");
                        var jLocalEndTime = new Date(jNewEndDate);                   
                        var jLocalSchedEnd = ('0' + jLocalEndTime.getHours()).slice(-2)+':'+('0' + jLocalEndTime.getMinutes()).slice(-2);
    ..
    ..
    and the the table display to display the local time:

    '<td>'+jLocalSchedStart+ " - " + jLocalSchedEnd+'</td>'+

    Now I need to change it so the Calendar is displayed for the local Day of the week correctly

    381 x 149 - 4K
    Post edited by John Chewter at 2013-09-09 06:51:11
    No longer using Airtime or Libretime.
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    Since Default Interface Time is set globally I think it's not possible.
    But I wish I am not right ;-)
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • I will try and write something based on the admin calendar because that DOES change according to timezone of user

    No longer using Airtime or Libretime.
  • Do you mean our widgets? Or which front-end schedule do you mean?
  • For example:
    I am setting up a WORLDWIDE station so I want the frontend weekly schedule (widget) to be correct in local time for the users. This saves everybody adding 7, 9 or -8 hours etc. to the displayed schedule.
    No longer using Airtime or Libretime.
  • OK, I was assuming you meant something like this. Thanks for clarifying. I will just take a look into how the information is retrieved/dealt with in our widgets. Are you running your own setup of Airtime or on SaaS?
  • Also it seems sensible to be able to change the starting day of the week because on a Sunday you just see forthcoming programs for the rest of Sunday.
    No longer using Airtime or Libretime.
  • Own airtime on Ubuntu
    No longer using Airtime or Libretime.
  • Yeah I've never liked that about the widget, I was thinking more of allowing how many previous/future days you want shown with a default of today only or something. I think I might rewrite this widget sometime in the future as it could definitely be done better.
  • I might beat you to it ;)
    I already changed it so the current playing show is highlighted.
    http://forum.sourcefabric.org/discussion/15809/an-039improved039-at-widget-jquery-showinfo-js-is-here
    Post edited by John Chewter at 2013-09-05 06:36:48
    No longer using Airtime or Libretime.
  • An option to start the week on the current day would do it.
    No longer using Airtime or Libretime.
  • Half way there now. I now have my weekly schedule listing displaying with local time as well as server time (UTC).

    Now I need to change it so the Calendar is displayed for the local Day of the week correctly

    No longer using Airtime or Libretime.
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator
    amazing work!
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • errm I think you mean that its amazing it works :)

    No longer using Airtime or Libretime.
  • Vote Up0Vote Down hoerichhoerich
    Posts: 627Member, Airtime Moderator

    errm I think you mean that its amazing it works :)



    that's right! I missed a few keys.
    Official Airtime Forum Manager
    --------------------------
    Most of the time an issue is located between keyboard and chair.
  • Just some simple javascript
    No longer using Airtime or Libretime.
  • Interesting. I think i found a philisophical mistake. This may be easier than I thought.. (hopefully)

    No longer using Airtime or Libretime.
  • Here I have a very modified & extended widget system working in test.
    Changed & Added Features:
    • Shows times in client's local time zone (as set on their pc/phone)
    • Brings 'Genre' to frontend
    • Brings 'Show Description' to frontend
    • Brings 'Color' & 'Background Color' to frontend - used to color Genre Box
    Wanted - testers - so that I can release this properly into the community
    No longer using Airtime or Libretime.
  • Here I have a very modified & extended widget system working in test.
    Changed & Added Features:
    • Shows times in client's local time zone (as set on their pc/phone)
    • Brings 'Genre' to frontend
    • Brings 'Show Description' to frontend
    • Brings 'Color' & 'Background Color' to frontend - used to color Genre Box
    Wanted - testers - so that I can release this properly into the community
    800 x 673 - 102K
    No longer using Airtime or Libretime.