M
Matteo
Hy everybody.
I'm not a html writer, but a sysadmin who's trying to help a user able
to compile an online form with IE but not with Mozilla (Moz1.6, Ns7.1,
Firefox 0.8+) due to a javascript date check.
Let's go straight to the point:
<script language="JavaScript">
alert("Date: "+Date.parse("2000-01-01"))
// On IE and Mozilla: "Date: NaN"
alert("Date: "+Date.parse("01-01-2000"))
// On IE: "Date: 946681200000"
// On Mozilla: "Date: NaN"
alert("Date: "+Date.parse("01/01/2000"))
alert("Date: "+Date.parse("2000/01/01"))
// On IE and Mozilla: "Date: 946681200000"
</script>
This happens on italian win2000 and winxp, italian IE6, italian Moz1.6,
english Ns7.1, english Firefox 0.8.0+.
Obviously the solution is the third example, and I've yet mailed it to
the webmaster, who is using the second format, 01-01-2000; but is it
correct that in both Mozilla and IE Date.parse doesn't accept the
iso8601 format 2000-01-01 or maybe is something of which mozilla
developers should be aware? Or maybe the examples above are an improper
use of Date.parse?
I read the paragraph 15.9.4.2 of ecmascript 262 pdf, but it's not so
clear about possible date formats; or maybe it refers to something that
I cannot understand.
Thank you.
Matteo
I'm not a html writer, but a sysadmin who's trying to help a user able
to compile an online form with IE but not with Mozilla (Moz1.6, Ns7.1,
Firefox 0.8+) due to a javascript date check.
Let's go straight to the point:
<script language="JavaScript">
alert("Date: "+Date.parse("2000-01-01"))
// On IE and Mozilla: "Date: NaN"
alert("Date: "+Date.parse("01-01-2000"))
// On IE: "Date: 946681200000"
// On Mozilla: "Date: NaN"
alert("Date: "+Date.parse("01/01/2000"))
alert("Date: "+Date.parse("2000/01/01"))
// On IE and Mozilla: "Date: 946681200000"
</script>
This happens on italian win2000 and winxp, italian IE6, italian Moz1.6,
english Ns7.1, english Firefox 0.8.0+.
Obviously the solution is the third example, and I've yet mailed it to
the webmaster, who is using the second format, 01-01-2000; but is it
correct that in both Mozilla and IE Date.parse doesn't accept the
iso8601 format 2000-01-01 or maybe is something of which mozilla
developers should be aware? Or maybe the examples above are an improper
use of Date.parse?
I read the paragraph 15.9.4.2 of ecmascript 262 pdf, but it's not so
clear about possible date formats; or maybe it refers to something that
I cannot understand.
Thank you.
Matteo