Open ptomato opened 3 years ago
Added some information from https://github.com/tc39/proposal-temporal/issues/1374.
If it can help in any way the week-date library I made has this supported both for ISO calendar in Hijri week Calendar (HWC).
You can see both implementation and documentation here: https://github.com/zamanapp/week-dates
Previous discussion at https://github.com/tc39/proposal-temporal/issues/634 and https://github.com/tc39/proposal-temporal/issues/1058.
Similar to
Temporal.Calendar.monthsInYear()
and the associatedmonthsInYear
properties on types that have a year (PlainDate, PlainDateTime, PlainYearMonth, ZonedDateTime), the proposal is to add aweeksInYear()
method to Temporal.Calendar andweeksInYear
properties to the types that have a year.Proposed semantics would be to return the integer number of the last week of the year. Alternatively, the number of weeks in the "week year" that the date falls in. (For example, 2021-01-01 is in week 53 of 2020 in the ISO calendar week-numbering rules.)
Also needed would be a
yearOfWeek()
method which returns the week year, or aweekYearOffset()
method which returns the difference between the week year and the calendar year.Advantages:
It's currently not possible to get this information in Temporal. This means that it's not possible to correctly output an ISO year-week-day date, since the year would need to be the week year.
Numbered weeks of the year are fairly commonly used in business contexts in Europe.
Concerns:
See "corner cases" below. This would have to be defined very carefully.
Prior art:
IYYY
in PostgreSQL formattingConstraints / corner cases: