Calendar issues
Mark Davis ☕
mark at macchiato.com
Thu Sep 13 13:31:39 PDT 2012
In ICU, we are using Gregorian eras (AD/BC) as customarily interpreted, and
there is no year zero. There isn't a simple way to get non-era years—and
that form is mostly interesting to techies, not normal people, which is why
we support the era form.
(If someone wanted to do it, you could probably get reasonable results by
taking the input date, parsing with a calendar, and if the year < 1, set
the year field to 1-year, get the date pattern for the locale, get the
number pattern for a negative integer in the locale, insert the
prefix/suffix around the year field in the date pattern, and format the
Calendar date. That's be a dozen or two lines of code, but would need some
extra code for exceptions.)
Mark <https://plus.google.com/114199149796022210033>
*
*
*— Il meglio è l’inimico del bene —*
**
On Thu, Sep 13, 2012 at 8:40 AM, Norbert Lindenberg <
ecmascript at norbertlindenberg.com> wrote:
>
> On Sep 13, 2012, at 6:55 , Andrew Paprocki wrote:
>
> >>>> and Explorer formats it as being in the year 1 BC. Safari calculates
> the day
> >>>> according to the Julian calendar, all others use the proleptic
> Gregorian
> >>>> calendar.
> >
> > That is very surprising to me. Can anyone comment on why Safari chose
> > that implementation?
>
> Probably because that's the default used for date and time formatting in
> ICU. ICU can be made to use a proleptic calendar by setting the Gregorian
> cutover to the beginning of time; I don't see an easy way to make it
> introduce a year 0.
>
> Norbert
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120913/1b174f94/attachment.html>
More information about the es-discuss
mailing list