js-temporal / proposal-temporal-v2

Future additions to Temporal
MIT License
24 stars 1 forks source link

Make calendar ID optional in withCalendar() methods #13

Open ptomato opened 3 years ago

ptomato commented 3 years ago

Previously proposed at https://github.com/tc39/proposal-temporal/issues/1324.

The proposal is that the withCalendar() methods of PlainDate, PlainDateTime, and ZonedDateTime should allow omitting the argument, or undefined, to mean the ISO calendar.

Advantages:

The ISO calendar acts like a default calendar elsewhere in Temporal, except where a calendar is explicitly needed from the programmer. But if you have a maybe-non-ISO date and want to convert it to ISO (which will be a very common operation when accepting external data), the developer needs to spell out 'iso8601' in every call site. This seems unnecessary, since it's not a call site where omitting the calendar might lead to unexpected results when encountering non-ISO calendars.

Concerns:

TBD

Prior art:

TBD

Constraints / corner cases:

TBD