Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Possible bug when using dateString with UTC timezone #26

arnesten opened this Issue · 2 comments

3 participants


If I do this:

var date  = new time.Date('2012-10-27', 'UTC');

it prints this:

'Sat Oct 27 2012 02:00:00 GMT+0000 (UTC)'

Notice that the time is 02:00:00. This is the result that I had expected:

'Sat Oct 27 2012 00:00:00 GMT+0000 (UTC)'

If I give '2012-10-27T00:00:00Z' to the constructor it gives the same result. And yes my local timezone at that date is GMT+0200.

Have I misunderstood something or is this a bug?


Can you try out the v0.8.4 release and let me know if this is still a problem? Thanks!


This seems to till happen in v0.11.0 – running the above code in a Node.js file with nothing else in it I get the same result:

'Sat Oct 27 2012 02:00:00 GMT+0000 (UTC)'

If I change the global timezone from my default Europe/Stockholm to UTC before running the time.Date(), by doing time.tzset('UTC');, then the result is instead:

'Sat Oct 27 2012 00:00:00 GMT+0000 (UTC)'

And if I set the global timezone to America/New_York then the result is:

'Fri Oct 26 2012 20:00:00 GMT+0000 (UTC)'

The Date object created always report itself as being in the UTC timezone, but it seems to be converted to UTC after being parsed in the global timezone rather than actually be parsed in the specified timezone as would be expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.