Post

JavaScript's date object has been tricky for years, but that is changing. The NEW Temporal API brings, 🌍 Easily handle time zones 📆 Precise date math 🕒 Parse ISO strings without errors ⌛ Durations, date ranges, and more. Start experimenting 👇 developer.mozilla.org/en-US/docs/...

developer.mozilla.orgTemporal - JavaScript | MDNThe Temporal object enables date and time management in various scenarios, including built-in time zone and calendar representation, wall-clock time conversions, arithmetics, formatting, and more. It is designed as a full replacement for the Date object.

26 reposts103 likes

Temporal inherits 3+ design flaws from CLDR: - (ISO) Weeks should have their own calendar system. - Gregorian lunar months (from its Easter Computus) should be available as their own calendar system. - There should be (at least) one optional level between year and month, e.g. season.

Put differently, within a calendar system, each grouping of dates should be a true superset of all smaller/descendant groupings, i.e. either each month consists of a whole number of full weeks or they are part of different systems used in parallel.

Also, the start (and therefore end) of a date should be able to differ from midnight. It should be simple for authors to declare additional (special-purpose,custom, novel or rare) calendar systems. 10^8 days is wide enough a span for all of recorded human history, but not enough for astronomy.

Hi! Thanks for the suggestions. A calendar-like abstraction for times of day was considered (called a "time scale" or "time calendar"), but it was not included due to limited use cases. It could still be added later.

2. Additional calendar systems such as the Christian liturgical calendar can be added later after they land in CLDR. There are multiple open CLDR issues for supporting more calendars. This is less a "design flaw" and more a resourcing issue. ...

3. An additional field larger than months but smaller than years was considered, but it was ultimately rejected because it doesn't translate well across locales and calendars. For example, there are Quarters, Seasons, Semesters, Trimesters. We suggest clients build these on top of Temporal.