How is Javascript Date handled in other languages?
I don't have the liberty of testing my Javascript on a foreign operating system. I would like to know if the following will work globally:
var d = new Date(
'Tue Aug 20 2011 16:00:00 GMT-0700 (Pacific Daylight Time)'
);
If a Spanish OS were to run this, would it crash? Would I have to use this instead?
var d = new Date(
'Mar Ago 20 2011 16:00:00 GMT-0700 (Pacífico Hora de verano)'
);
I use strings to initialize Date because I hate using the numerical approaches which all require translating into UTC.
No. The string format is strict about language. English only. I have a Hebrew OS and I use English just fine. (Trying Hebrew crashes it).
精彩评论