In comp.lang.javascript message <54429e6d-86a8-48ff-8d52-f7e6cd9dafa4@o1
4g2000vbo.googlegroups.com>, Wed, 3 Jun 2009 06:54:21, Adam Peller
I've encountered a couple of surprising behaviors in Date relative to
daylight savings rules in certain timezones. The first appears to be
specific to FF and a host platform on the Unix epoch date:
Summer Time rules are not governed by time zones. All EU has the same
rules (assuming UTC=GMT), but covers 3 zones. Russia has one set of
rules, but is in about 11 time zones. Perth & Beijing are in the same
zone, but have different rules. Chile, Venezuela, and Labrador appear
to be in the same zone, but have different rules.
You need to say exactly what the machine and OS are, and to what
location they are set. Unless you write the full story with complete
unambiguity, one cannot be certain what you mean.
https://bugzilla.mozilla.org/show_bug.cgi?id=487897
1
// you'd expect 0
which is unfortunate, since time=0 is often used in Date calculations.
IST has at least three possible meanings in this context.
If IST is supposed to represent Irish Standard Time, you should be aware
that the British Isles, normally with clocks set to GMT in winter, had
them advanced by an hour for three years around that time. The UK did
this by extending the duration of British Summer Time (BST and calling
the time British Standard Time (BST).
The Irish, presumably noting that Summer is longer than Winter, did it
differently. While the Republic of Ireland's clocks were kept in
agreement with those of the UK of GB & NI, the RoI apparently advanced
their Standard Time by one hour and, instead of putting them forward for
the Summer, put them back for the Winter. It seems unclear what they
did at the end of the "extended-summer" period, except that their clocks
continued to agree with UK ones.
Now, in the EU, we all must change the clock at 01:00 UTC (or GMT) on
the last Sundays of March and October; but I don't recall whether we are
permitted to choose between putting them forward for the Summer or back
for the winter.
The "TZ" notation could handle Winter Time by swapping the dates and
using a negative shift; but the detailed grammar may not allow the
nece3ssary minus sign.
The second problem appears in most browsers I've tested. In essence,
construct a Date object for the day where summer time begins in
Argentina, and it throws you back an hour to the previous day:
Wikipedia says that only some of Argentina has Summer Time.
http://bugs.dojotoolkit.org/ticket/9366
Sat Oct 17 2009 23:00:00 GMT-0300 (ART)
Because the date shift occurs at midnight, perhaps there really is no
'midnight' that day?
Consult the Azores setting (or Canaries?). Some such place is an hour
behind GMT in Winter (i.e. like New York, but not as bad), and, if
following EU rules, must change its clocks either to or from midnight
local time.
I'm wondering why it throws me backwards instead
of forwards, unless this is a bug in some algorithm which assumes
northern hemisphere rules? Using Date as a container for month and
date, especially in local time, clearly has its problems,
It is not such. It contains only a count of milliseconds with
1970-01-01 00:00:00 UTC being the Zero Second. There are methods to
calculate, for example, the Month. Timing may be able to demonstrate
that getMonth is slower than getTime.
Reports of offset are obtained by consulting, or by having consulted at
browser load (or ?), the OS for the CURRENT Summer Time Rules for the
set location - OR by asking the OS to convert. There can be no problem
with Windows before Vista, as it only knows one set of rules per
location. AIUI, Vista knows two sets, to handle the US rule change of
2007-03-01 unspecified time; AIUI, a UNIX system knows all. Therefore,
Vista & Unix potentially can commit the sin of using non-current rules
nor non-current dates.
but I think
it's generally expected behavior that the date remain constant. Is
this a bug in JS? In the host OS? Or does this actually make sense to
anyone? Generally speaking, are there rules for what should happen
during a dst leap, particularly on the boundary?
There is ambiguity in the Real World Rules as to whether, for example,
on the last Sunday of March the ideal UK clock will show 01:00 for an
infinitesimal time before changing to 02:00, or whether at the end of
00:59 it will go straight to 02:00. There will also be doubt about what
implementations do.
Example : DOS has 0x1800B0 ticks per day, starting at 0. The code
indicates, IIRC, that the clock actually is set to 0x1800B0, but there
is then a comparison which will set it to 0x0 and set the Tomorrow bit.
But the nature of DOS makes that sequence apparently un-interruptible,
so that user code cannot see 0c1800B0. BTW, in code I saw, the
comparison is for equality; so if one sets the value to 0x1800B0 by a
sort of "Poke" it will continue to rise, TIME shows hours>23, and
eventually confusion sets in.