JavaScript Dates in Other Countries

E

Evertjan.

Dr J R Stockton wrote on 08 jan 2010 in comp.lang.javascript:
x
You should learn to write English before you try to learn JavaScript.

Never trust other newsreaders to be set to use a monospaced font.

This is debatable. I think a comment on the English is only on topic if the
errorit degrades the meaning of the sentence, and if you speak the other's
tongue as well as he/she speaks English. This being a nonlocalized NG.
//turn days into an int (removes leading zero's)
tmp[0]++;tmp[0]--;

tmp[0] = +tmp[0];
 
J

John G Harris

In comp.lang.javascript message <bc516abf-d1ae-4c3d-847d-4eafbb473f75@z4
1g2000yqz.googlegroups.com>, Thu, 7 Jan 2010 08:30:00, Laser Lips
<[email protected]> posted:


You still don't understand Booleans.
<snip>

But in March last year you wrote that :

"It is not an error; it is syntactically correct and has the expected
effect. I've seen the equivalent in other languages; some people claim
that it's easier to understand."

If you can't be consistent why should anyone believe you ?

John
 
T

Thomas 'PointedEars' Lahn

Dr said:
Be aware that setFullYear can be given three arguments.

(per ES3F and ES5)

This is very useful advice. Thank you.

It lead me to find out (you probably know that already) that several Date
prototype setters support several arguments, too. In a nutshell:

15.9.5.30 Date.prototype.setSeconds (sec [, ms ] )
15.9.5.31 Date.prototype.setUTCSeconds (sec [, ms ] )
15.9.5.32 Date.prototype.setMinutes (min [, sec [, ms ] ] )
15.9.5.33 Date.prototype.setUTCMinutes (min [, sec [, ms ] ] )
15.9.5.34 Date.prototype.setHours (hour [, min [, sec [, ms ] ] ] )
15.9.5.35 Date.prototype.setUTCHours (hour [, min [, sec [, ms ] ] ] )
15.9.5.38 Date.prototype.setMonth (month [, date ] )
15.9.5.39 Date.prototype.setUTCMonth (month [, date ] )
15.9.5.40 Date.prototype.setFullYear (year [, month [, date ] ] )
15.9.5.41 Date.prototype.setUTCFullYear (year [, month [, date ] ] )

But I wonder, are these implemented consistently? Surely you have already
done some research on the matter.


PointedEars
 
D

Dr J R Stockton

In comp.lang.javascript message <[email protected]>,
(per ES3F and ES5)

This is very useful advice. Thank you.

It lead me to find out (you probably know that already) that several Date
prototype setters support several arguments, too. In a nutshell:

But surely you have read ECMA 263 3 & 5, and ISO/IEC 16262, from one end
to the other ?

Multi-argument setters are included in
15.9.5.30 Date.prototype.setSeconds (sec [, ms ] )
15.9.5.31 Date.prototype.setUTCSeconds (sec [, ms ] )
15.9.5.32 Date.prototype.setMinutes (min [, sec [, ms ] ] )
15.9.5.33 Date.prototype.setUTCMinutes (min [, sec [, ms ] ] )
15.9.5.34 Date.prototype.setHours (hour [, min [, sec [, ms ] ] ] )
15.9.5.35 Date.prototype.setUTCHours (hour [, min [, sec [, ms ] ] ] )
15.9.5.38 Date.prototype.setMonth (month [, date ] )
15.9.5.39 Date.prototype.setUTCMonth (month [, date ] )
15.9.5.40 Date.prototype.setFullYear (year [, month [, date ] ] )
15.9.5.41 Date.prototype.setUTCFullYear (year [, month [, date ] ] )

But I wonder, are these implemented consistently? Surely you have already
done some research on the matter.

For any methods and arguments given in ECMA 3, which was finished by
late 1999 and presumably available in draft to browser-writers before
them, one should expect implementation in all reputable "full" browsers
in all vaguely current versions.

I've frequently used (and probably posted here??) setFullYear with YMD
and setHours with hms - and never noticed any problem; and I've never
AFAIR seen any problem reported.

However, Firefox 2.0.0.3-16 treated D < 1 as D = 1 in Date.UTC(Y,M,D)
(Firefox 3 is OK) and in retrospect it would have been well to test the
set routines above (and set[UTC]Date) with D = 0.
 

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

No members online now.

Forum statistics

Threads
474,079
Messages
2,570,575
Members
47,207
Latest member
HelenaCani

Latest Threads

Top