Does the Date object ever use a non-Gregorian calendar?

calendar, date, javascript

Solution

From the ECMAScript specs (3rd edition and 5th edition are nearly identical in this regard, but am quoting the 5th):

15.9.1.9 Local Time

Conversion from UTC to local time is defined by `LocalTime(t) = t + LocalTZA + DaylightSavingTA(t)` Conversion from local time to UTC is defined by `UTC(t) = t – LocalTZA – DaylightSavingTA(t – LocalTZA)` Note that `UTC(LocalTime(t))` is not necessarily always equal to `t`.

`LocalTZA` refers to local time zone adjustment, and `DaylightSavingTA` is the adjustment for daylight savings.

I have not found any evidence of a browser (current or historic) that does anything different when a non-Gregorian calendar is enabled on a user's machine.

Problem

Does the `Date` object in Javascript ever use a non-Gregorian calendar? The MDN and MSDN docs outline the methods on the `Date` object and reference UTC and IETF-compliant RFC 2822 timestamps. The Wikipedia article mentions Days are conventionally identified using the Gregorian calendar, but Julian day numbers can also be used. The MDN and MSDN documentation just says that the non-UTC methods refer to the "local time", but doesn't define what "local time" is. I am working on interfacing to a webservice which is giving me back some data that includes a day-of-year field, which I need to compare to current day-of-year. I am well aware about the pitfalls of relying on an accurate time from a user's machine, and am fine with any problems that result from bad timezones and bogus date settings. I am concerned, though, about users in locales that don't use the Gregorian calendar, and what their browsers will give back if I use the `.getDate()`, `.getMonth()`, and `.getFullYear()` methods to compute day-of-year. So, in practice, does "local time" in Javascript ever refer to a non-Gregorian calendar system, such as the Hebrew or Persian calendars?

Original source