Dates, Times and Timezones

Home Forums General [ No Support Zone ] Feature Request Dates, Times and Timezones

Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #37901
    Ravi Kiran Katha
    Participant
    Hello Mr. Vibe, I had recently purchased this theme and currently in the setting up phase. I have a very basic requirement regarding the times/schedules applicable across various current features in the theme - for e.g. Course batch schedules (currently being developed), event schedules etc. The dates/times need to be timezone aware. This helps the students visiting the portal from across different timezones. A practical scenario for the requirement is when the Wordpress timezone is TZx and a student from TZy wants to enroll for a course or attend an online webinar event. As of now, the complete portal shows times/dates in TZx. So the user has to calculate the time difference for each date/time displayed to correlate them in his/her own timezone - TZy. This applies to the other user types - like the Instructors & Admins from other timezones, when they create/edit an online ILT (Instructor Led Training) course or an event, they should calculate the time difference between TZx & TZy before entering the schedules. I have the following suggestions for the implementing this feature
    1. Admin Back-End
    • The admin back-end can accept an extra optional timezone parameter, wherever it takes date/time values. If not specified, defaults to the portal timezone.
    1. Front-End
    1. All date/time display areas can be emitted using a short code [local_time] or similar
    2. This short code can be implemented inside the theme or as a new plugin
    3. This new implementation should also add a Timezone Selector widget, which can be injected into the header or footer or anywhere else (may be using another short code time_zone_switcher). This selector shows or allows to change the timezone in which the dates/times are shown in the portal
    4. The selector checks for a session cookie for user's timezone preference. If a session cookie is not found, the presence of a persistent cookie is checked. If the session cookie is not found but the persistent cookie is found, the persistent cookie is copied over to the session cookie. At the end of this processing, if a session cookie is found, it is used as the preferred timezone. Else the user's timezone is detected from the browser and saved as session cookie. If the user changes/sets a specific timezone from the timezone switcher, it is saved to the session and persistent cookies. The switcher should allow to reset the cookies to restore the detection behavior.
    5. The [local_time] shortcode shall display the date/times in the currently selected timezone resulting from the above step
    This is a rough outline how it can be - open for discussion & changes. Let me know your comments Thanks & Regards Ravi
    #39118
    MrVibe
    Keymaster
    Yes, we use the TimeZone setting saved in WP Admin - Settings - General section where ever it is sensitive. In most cases we display the time difference rather than actual date and time value. If in cases it is not working correctly then it is bug not a feature :). It would be great if you can point out exact steps where you think we should improve.
    #39131
    Ravi Kiran Katha
    Participant
    Thanks for the reply. I am not talking about any issue with the theme. The dates/times can be stored in the database with respect to the wordpress timezone => I am sure the theme already does this. When we display the dates/times in the front-end, they all get displayed in Wordpress timezone. There is no bug in this implementation either. Lets consider the following scenario
    • The wordpress timezone is Pacific time
    • We have an online webinar event scheduled at 11 AM (which means 11 AM PT)
    • A user from EST timezone visits the website
    • He sees "11 AM" or "11 AM PT" on the front-end based on the wordpress time display format
    • In either case, for him to attend that webinar, he has to check the time difference between EST (his own timezone) to that of the portal timezone (PT) which is about 3 hrs. So he has to be ready by 2 PM EST
    The difference calculation shown above might be easy, but for some timezones, the calculation becomes difficult, at least not as easy as the above example. So my point is that the displayed time zone should be configurable in the front-end. It should be auto detected on the user's first visit and then configurable via a dropdown by the user. Then all dates/times displayed on the front-end should be converted by some plugin or theme code to the configured front-end timezone. Since this front-end timezone feature is not present via any wordpress plugin or in this theme, I suggested it as a new feature.
    #43306
    Ravi Kiran Katha
    Participant
    Any comment or suggestion or workaround?
    #43534
    MrVibe
    Keymaster
    Although your point is valid. My thoughts on this is that is where ever this is sensitive we show the difference, so instead of user seeing :
    • He sees "11 AM" or "11 AM PT" on the front-end based on the wordpress time display format
    We want to show him
    • He sees "12 hours" remaining
    So, now I want to know where exactly are you seeing this ? The above solution is easy for us to implement rather than implementing a geolocation API and it might not be necessary in the given use cases.  
    #43652
    Ravi Kiran Katha
    Participant
    Attached a screenshot with the time display. Show "time from now" notation would not solve the problem. The calculation will still be complex if the event is a distant event. How difficult is to set wordpress timezone per request? If that is feasible, we can use some javascript libraries (like jstz) and set a cookie with the current user's timezone. That cookie can be checked for every request on the backend as the first step & wordpress timezone setting can be set for that request. That avoids using geolocation api and still leaves all other code intact without any required modifications.
    #44569
    Ravi Kiran Katha
    Participant
    Never mind, I was able to create a Wordpress Plugin to cater to this requirement. No need to implement in the theme. The plugin is at WP User Timezone for your reference. Thanks & Regards Ravi
    #121392
    lewiskeyte
    Participant
    Hi, I'm also having an issue with this. Specifically, the event timing is not timezone aware. When creating an event, a user can put in a time and timezone; this is reflected in the event listing, but does not change based on the user timezone. By itself, this is an issue but can be lived with. Unfortunately, the ICS file downloaded from the event is not adjusted, so calendar applications (which assume the ICS file timestamps are in UTC) add/subtract the user's timezone. The screenshots (event creation in the admin, event listing on the site, and opening the event in Outlook) and .ics file are at this link: <span class="download_link_link" style="color: #409fff; word-wrap: break-word;">https://we.tl/Yo8YnvRinV</span> I've contacted EventOn support but was told to contact the creators of WPLMS since EventOn came bundled with it. I also tried the WP User Timezone plugin above - it detects the timezone, but does not change the times displayed in event listings.
Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Dates, Times and Timezones’ is closed to new replies.