Date Object Doesn't Work.

Andrea Giammarchi andrea.giammarchi at gmail.com
Thu May 29 11:07:31 PDT 2014


All I was saying is that you should always do dates operations through UTC
values which has consistent behavior across engines.


On Thu, May 29, 2014 at 10:00 AM, Garrett Smith <dhtmlkitchen at gmail.com>
wrote:

> On 5/28/14, Andrea Giammarchi <andrea.giammarchi at gmail.com> wrote:
>
> Hi Andrea -
>
> > While I agree we should expect consistent results, you might get more
> > consistent one via UTC time, i.e.
> >
> > ```
> > var r = new Date(2013, 02, 10),
> >     r2 = new Date(2013, 02, 10),
> >     diff = 7;
> > r.setUTCHours(2 + diff);
> > r2.setUTCHours(3 + diff);
> > ```
> >
> > Above operation will actually show 1 hour difference in all browsers
> > (visually 2 due -8 VS -7 zone)
> >
>
> The difference between 2am and 3am on that date, for this timezone
> (America/Los_Angeles), is zero. diff isn't needed to calculate
> DST-free difference.
>
> r
> Sun Mar 10 2013 01:00:00 GMT-0800 (PST)
>
> Given arbitrary dates and timezones, tzo difference might or might not
> cross DST and that might be adjusted by the user.
>
> But calculating DST-free difference seems like a safer bet. And so the
> way to do that would be to send a local date but treat it as UTC.
> --
> Garrett
> @xkit
> ChordCycles.com
> garretts.github.io
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140529/bab9fc42/attachment.html>


More information about the es-discuss mailing list