Another Date Bug

  • Thread starter Dr J R Stockton
  • Start date
D

Dr J R Stockton

After thinking about what it should give, try
new Date("2099/12/28 GMT").getUTCDate()
in various browsers.

MS IE 8, FF 3.6.13, Op 10.63, Cr 8.0 all get 28; and so do I.

Safari 5.0.3 (2 copies) gets 27.

Safari also gets 0100/01/03 wrong, and various other dates.




Also, but not with Safari or IE<=9, it would be nice to know whether
there's anything wrong in the Form at
<http://www.merlyn.demon.co.uk/uksumtim.htm#Fig1>.

The page is 86kB, but the Figure is well under a screenful, and the
relevant source, including HTML, about 500 lines of which about 200 is a
data table.

The above error was found and can be seen in 0100/01/03 on that Form,
but does not impair the picture.
 
A

Alter Ego

Dr J R Stockton said:
After thinking about what it should give, try
new Date("2099/12/28 GMT").getUTCDate()
in various browsers.

MS IE 8, FF 3.6.13, Op 10.63, Cr 8.0 all get 28; and so do I.

Safari 5.0.3 (2 copies) gets 27.

Safari also gets 0100/01/03 wrong, and various other dates.




Also, but not with Safari or IE<=9, it would be nice to know whether
there's anything wrong in the Form at
<http://www.merlyn.demon.co.uk/uksumtim.htm#Fig1>.

The page is 86kB, but the Figure is well under a screenful, and the
relevant source, including HTML, about 500 lines of which about 200 is a
data table.

The above error was found and can be seen in 0100/01/03 on that Form,
but does not impair the picture.

Don't worry 'bout that, Doc. None of us will be alive on 2099-12-28 neither
there will be web browsers as we know them today.
 
D

Denis McMahon

Don't worry 'bout that, Doc. None of us will be alive on 2099-12-28
neither there will be web browsers as we know them today.

Reminiscent of the attitude that brought us the y2k and the y2k38 issues.

In the late 1960s and early 1970s, the system clocks rolling over in
2038 probably wasn't perceived as an issue by people who didn't
generally expect to live beyond about 2020 or so.

Rgds

Denis McMahon
 
T

Tim Streater

Denis McMahon said:
Reminiscent of the attitude that brought us the y2k and the y2k38 issues.

In the late 1960s and early 1970s, the system clocks rolling over in
2038 probably wasn't perceived as an issue by people who didn't
generally expect to live beyond about 2020 or so.

In the late 60s and early 70s, it was a no-brainer to shave two digits
off the years because a 50Mbyte hard drive was considered huge, as was
half a meg of RAM.
 
G

Gregor Kofler

Am 2011-03-02 10:57, schrieb Tim Streater:
In the late 60s and early 70s, it was a no-brainer to shave two digits
off the years because a 50Mbyte hard drive was considered huge, as was
half a meg of RAM.

Add at least 10 years to your figures.

Gregor
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]
rlyn.invalid>, Tue, 1 Mar 2011 23:27:50, Dr J R Stockton
After thinking about what it should give, try
new Date("2099/12/28 GMT").getUTCDate()
in various browsers.

MS IE 8, FF 3.6.13, Op 10.63, Cr 8.0 all get 28; and so do I.

Safari 5.0.3 (2 copies) gets 27.

Safari also gets 0100/01/03 wrong, and various other dates.

Test code is now at <http://www.merlyn.demon.co.uk/ks-datex.htm#XX23>
and more at <http://www.merlyn.demon.co.uk/ks-datex.htm#S503>. For the
month-day combinations that I have tried, it is wrong for a substantial
proportion of dates outside years 1802-2034. Outside those years, and
after year 100, the pattern appears to depend only on Year%400.



A second test now uploaded (Test 2) reveals the true horror. The
pattern
"1400/03/01 GMT" 0 1
"1634/03/01 GMT" 1 0
"1700/03/01 GMT" 0 1
"1767/03/01 GMT" 1 0
repeats at 400 year intervals in the results, which show one-day CHANGES
in error. Fortuitously, the lifetimes (so far) of all of us are
included in a good patch. But the bug will begin to affect current
dates in under a quarter of a century.


I have used menu item Help, Report Bugs to Apple. Thrice.




One can probably rely on the setTime and getTime methods, after checking
on a few values inside and outside the 10^8 day range and on not
depending on the difference between local clock and GMT. Perhaps an
exhaustive Date Object Test Page should be constructed, testing all
properties for a large number of dates including any possibly
troublesome cases.


P.S. Firefox 3.6.14 is released. I can crash it as in 3.6.13 and
earlier. Reported. See <http://www.merlyn.demon.co.uk/ff-randm.htm>
 
V

VK

Safari gets it right, many others do it intentionally wrong for the
approx lifespan of the active generation. That allows to keep in
action the primitive formula "UTC is just like GMT but the latter is
more proper, modern and much cooler naming". Good enough for some half-
literate libraries' diggers that proudly call themselves "SC
specialists" in this century - _no_one_ meant in here - yet pretty
pity for someone demonstrating so much of interest in astronomy
aspects ( http://www.merlyn.demon.co.uk/#ast )

Do you realize that GMT_Time !== UTC_Time ?

Do you realize that forced conversion of one units to another unit
(say pounds to kilos or GMT days to UTS days) with integer result
implied rather often or always lead to rounding errors?

Do you have a notion of leap seconds? If not then here and
immediately: http://en.wikipedia.org/wiki/Leap_second

I dare to skip on the fundamental matters such as the Earth turning
around the Sun and around its axis and the latter movement slows down
- unfortunately for our very distant ancestors.

Armed with all newly obtained/gained back knowledge you may envisage
that say exactly at the noon Dec. 28 2099 Greenwich Mean Time the
actual noon by Coordinated Universal Time will be fractions to the
east from Greenwich.
So Safari JavaScript* fairly tells you the truth. If one doesn't like
it then let him stay within one system only:
var t = new Date(Date.UTC(2099, 11, 28, 0, 0, 0, 0));
alert(t.getUTCDate()); // 28 on Safari as well


*Pointed Ears with his naming psichospasms is kindly going to hell
 
D

Dr J R Stockton

Tue said:
Don't worry 'bout that, Doc. None of us will be alive on 2099-12-28
neither there will be web browsers as we know them today.

Thomas might be. But might you be alive on 2034-03-01?
 
T

Thomas 'PointedEars' Lahn

Dr said:
Alter Ego posted:

Thomas might be.

I sure hope so. Vulcans live more than 300 standard years
(and even afer they die they are not really dead)! ;-)


PointedEars
 
T

Thomas 'PointedEars' Lahn

Dr said:
Alter Ego posted:

Thomas might be.

I sure hope so. Vulcans live more than 300 standard years
(and even after they die they are not really dead)! ;-)


PointedEars
 
T

Thomas 'PointedEars' Lahn

VK said:
[…]
Do you realize that GMT_Time !== UTC_Time ?

Do you realize that forced conversion of one units to another unit
(say pounds to kilos or GMT days to UTS days) with integer result
implied rather often or always lead to rounding errors?

Do you have a notion of leap seconds? If not then here and
immediately: http://en.wikipedia.org/wiki/Leap_second

ROTFL. That's like asking the Pope if he was a Roman-Catholic!
*Pointed Ears with his naming psichospasms is kindly going to hell

It's _PointedEars_, without space in-between.


PointedEars
 
D

Dr J R Stockton

In comp.lang.javascript message <cc221c89-ce64-4015-b0b3-a0bf58c2402b@o1
0g2000vbg.googlegroups.com>, Thu, 3 Mar 2011 05:24:06, VK
Safari gets it right, many others do it intentionally wrong for the
approx lifespan of the active generation.

Were this an audio medium, one would be able to say that your speaking
orifice remains at the wrong end of your alimentary canal.
That allows to keep in
action the primitive formula "UTC is just like GMT but the latter is
more proper, modern and much cooler naming".

Entirely irrelevant to the point in question. JavaScript treats "GMT"
and "UTC" identically, though it does not recognise leap seconds. The
page will in fact test both GMT and UTC. The error found is entirely
different, as is clear from the test page cited.

Do you realize that GMT_Time !== UTC_Time ?

If you had read my site, you would have had an opportunity to know that.
Do you have a notion of leap seconds? If not then here and
immediately: http://en.wikipedia.org/wiki/Leap_second

And that. I've known people who helped to make Leap Seconds.
I dare to skip on the fundamental matters such as the Earth turning
around the Sun and around its axis and the latter movement slows down
- unfortunately for our very distant ancestors.

It seems more likely to affect descendants.
*Pointed Ears with his naming psichospasms is kindly going to hell

But he seems to be stuck in the queue. YSCIB.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,787
Messages
2,569,629
Members
45,332
Latest member
LeesaButts

Latest Threads

Top