Philip Chimento Igalia, in partnership with Bloomberg TC39 March 2021
from()
2020-08-05T20:06:13+09:00[Asia/Tokyo][u-ca=japanese]
roundingMode: 'halfExpand'
'ceil'
'floor'
'trunc'
monthCode
Temporal.now.plainDate('chinese').monthCode === "M03"
"M05L"
Symbol.species
this
class MyPlainDateTime extends Temporal.PlainDateTime {} const mpdt = new MyPlainDateTime(2021, 3, 9, 'iso8601'); mpdt.add({ days: 1 }) // ↪ Temporal.PlainDateTime instance MyPlainDateTime.from('2021-03-10') // ↪ Temporal.PlainDateTime instance
Array.prototype.sort()
Temporal.(type).compare()
ZonedDateTime.compare()
Instant.compare()
PlainDate
PlainDateTime
PlainYearMonth
equals()
const g = Temporal.PlainDate.from({ year: 2021, month: 3, day: 10, calendar: 'gregory' }); // ↪ 2021-03-10[u-ca=gregory] const h = Temporal.PlainDate.from({ year: 5781, month: 6, day: 26, calendar: 'hebrew' }); // ↪ 2021-03-10[u-ca=hebrew] Temporal.PlainDate.compare(g, h) // previously: -1 // proposed: 0
Previously:
const origFrom = Temporal.Calendar.from; Temporal.Calendar.from = function (calendarLike) { if (calendarLike === 'custom-calendar') return new MyCustomCalendar(); return origFrom(calendarLike); } Temporal.PlainDate.from('1999-12-31[u-ca=custom-calendar]'); // => Party like it's 1999
MyCustomCalendar
(just an example, not a proposed API)
function calendarResolver(id) { if (id === 'custom-calendar') return new MyCustomCalendar(); return Temporal.Calendar.from(id); } Temporal.PlainDate.from('1999-12-31[u-ca=custom-calendar]', { calendarResolver });
Should these be 12 or 13 and should any of them be different?
const p = Temporal.now.plainDateTimeISO(); Temporal.Calendar.prototype.monthsInYear = () => 13; p.monthsInYear // => p.calendar.monthsInYear(p) // => p.toPlainDate().monthsInYear // => p.toPlainYearMonth().monthsInYear // =>
month
3
"M03"