Still very much work in progress, so there are bugs and the API has not been fully defined (or documented) and is subject to major changes.
Date object, give better accuracy, flexibility and be cross-browser.
Besides the standard Gregorian calendar, the Julian calendar is also available. This allows for AstroDate to be used in astronomical calculations. A set of routines will be made available for changing between systems and methods for obtaining Julian Day Numbers, Julian Dates, Modified Julian Dates, Delta Time and Terestrial Time etc.
For dates beyond the normal
BigNumber.js is the library chosen for this.
AstroDate includes an ISO 8601 parser as one means of setting the date and time, other methods will be available, ie. using an Array and Object of discrete values.
As with ISO 8601 and the Proleptic calendars, Astronomical year numbering will be used for input and so have a year zero. Outputs may be formated to use either Astronomical year numbering or Calendar Era numbering, ie. BC/AD.
It is not intended for AstroDate to be a generic date parser and handle formats like
13/10/12. Though in future it will be possible to develop addons to do this.
The defaut language is 'en'.
Once loaded use
AstroDate.lang('en'); to set the default application language, or change a particular instance
Loaded languages may be modified for locale, use
AstroDate.locale('sr_ME'); to set the default application locale, or change a particular instance
'full' locale format, options are
.toISOString() has no modifiers and will produce a standard ISO 8601 time-stamp string, ie.
.format("YYYY'-W'ww'-'E") // 2013-W46-3
Date and time formats are specified by date and time pattern strings. Within date and time pattern strings, all unquoted ASCII letters [A-Za-z] are reserved as pattern letters representing calendar fields.
astrodate supports the date and time formatting algorithm and pattern letters defined by UTS#35 Unicode Locale Data Markup Language (LDML)
Any characters in the pattern that are not in the ranges of ['a'..'z'] and ['A'..'Z'] will be treated as quoted text. For instance, characters like ':', '.', ' ', '#' and '@' will appear in the resulting time text even they are not embraced within single quotes.
A pattern containing any invalid pattern letter will result in a thrown exception during formatting.