I’ve had some issues with pushing strings in JSON to a browser and having the browser parse them correctly. Some browsers will take strings as argument, some want numbers — it’s a bit confusing. To avoid all confusion, I recommend making a new date and then setting the values, rather than using the ambiguous constructors, which are implemented differently on different browsers.
As an example
new Date(“2010, 12, 25”);
and
both yield a date in Firefox, but not in IE.
Better is to do this:
Note that month is 0 based, so 0 is January, 11 is December.
Leave a Reply