var date = new Date('2012-11-29 17:00:34 UTC');
date.toString();Omar,That sounds about right to me - doing the time conversion to local time on the client side via JavaScript, as the browser typically knows what timezone it is set in. This approach is what I am doing for a project here at edX: I send down to an Ajax client a ISO8601 formatted string and then convert to a display string in local time. I'm also using the DateJS utility library which I've found helpful in parsing ISO8601 formatting date strings.However scope of work to have specifically the Open edX dashboard do the time conversion client-side is unknown to me. There might be a lot of code changes required. Then - unfortunately - other areas of the Open edX experience (e.g. inside courseware) is still presented in UTC, so changing the Dashboard is only a partial solution.
{% load tz %}
The UTC time is {{ object.date }}
{% localtime on %}
The local time is {{ object.date }}
{% endlocaltime %}
Best wishes and good luck,Chris Dodge@edx.org
On Monday, March 9, 2015 at 5:07:31 PM UTC-4, Leslie Gerhat wrote:Hi Omar,That seems like a reasonable approach to me. We'd love to see this come back to the platform as a pull request if you take it on. One note on where to pull the time zone. For the most reliable information, I would wait until the under-development User API and Profile functionality releases to edX-platform (anticipated release end of March), where we'll give users the ability to specify their time zone in platform, as opposed to guessing it. All the methods you list can lead to inconsistent or incorrect, which is even worse than displaying it in UTC.Let me know if you have further questions or thoughts!Thanks,Leslie GerhatedX Product ManagerTeaching and Learning Tools
On Sunday, March 8, 2015 at 10:00:51 AM UTC-4, Omar Al-Ithawi wrote:Hi,The LMS shows the date/time in UTC in many pages including the dashboard and the courseware pages.It is easy (at least to me) to immediately convert it to my local time.As a student I would like to see it in my local time.I have the following approaches for now:
- Always provide the time in ISO UTC format and make the conversions on the client-side:
var date = new Date('2012-11-29 17:00:34 UTC'); date.toString();- Ask the users for their timezone, calculate the local time on the server and print it.
There are many imperfect methods to figure out the user's timezone including: 1) Country? 2) IP Address, or 3) The browser's default timezone.What do you think?Thanks,
Senior Engineer, Edraak.org
Queen Rania Foundation
for Education & Development
T +962 6 4016464 Ext. 700