Today, the Gregorian calendar is accepted as an international standard, although several countries have not adopted it, including Afghanistan, Ethiopia, Iran, Nepal and Saudi Arabia. Many countries use the Gregorian calendar alongside other calendars, and some use a modified Gregorian calendar.
Changes of 1752 The Julian Calendar was replaced by the Gregorian Calendar, changing the formula for calculating leap years. The beginning of the legal new year was moved from March 25 to January 1. Finally, 11 days were dropped from the month of September 1752.
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?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With