Opened 8 years ago

Closed 8 years ago

Last modified 7 years ago

#618 closed defect (fixed)

dojo.date.fromIso8601 bug ..

Reported by: elricho66@… Owned by: mumme
Priority: high Milestone:
Component: General Version: 0.2
Keywords: Cc:
Blocked by: Blocking:

Description

dojo.date.fromIso8601 uses new Date(0) to create a date.
Date(0) creates a date in UTC .. When using the date returned from
this function it will apply your timezone offset (internally by Javascript).
This is probably not what the author intended.

Replace

return dojo.date.setIso8601(new Date(0), string);

With

return dojo.date.setIso8601(new Date(0,0,0,0,0,0), string);

Since Date(0,0,0,0,0,0) will create a date in your local timezone and
no timezone futzing will be applied ..

Happy dojoing :-)

cheers
r

Change History (4)

comment:1 Changed 8 years ago by ttrenka

  • Milestone set to 0.3release

comment:2 Changed 8 years ago by mumme@…

  • Owner changed from anonymous to mumme

comment:3 Changed 8 years ago by mumme@…

  • Resolution set to fixed
  • Status changed from new to closed

Actually I cant see any difference at all in the return value.

According to ECMA standards a different internal method will be used when new Date is called with 2 - 7 arguments, so I ended up only doing Date(0, 0)

new Date(0, 0, 0, 0, 0, 0) = Sun Dec 31 1899 00:00:00 GMT+0100
and 
new Date(0, 0) = Mon Jan 01 1900 00:00:00 GMT+0100

*in my timezone*

The timezone is the same as you can see, only one date of and the dates will be changed in the setIso8601Date function anyways.

So hopefully this will be fixed as of rev3875

Please reopen if not.

Regards
Fredrik Johansson

comment:4 Changed 7 years ago by anonymous

  • Milestone 0.3release deleted

Milestone 0.3release deleted

Note: See TracTickets for help on using tickets.