Skip to content

Commit

Permalink
Make CalendarDateWeekOfYear return undefined
Browse files Browse the repository at this point in the history
...for all calendars without well-defined week calendar system
  • Loading branch information
Aditi-1400 committed Feb 7, 2024
1 parent 133cddc commit 33380bd
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions spec/calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,7 @@ <h1>
1. Set _calendar_ to ! CreateTemporalCalendar(_calendar_).
1. Return ? Call(%Temporal.Calendar.prototype.weekOfYear%, _calendar_, « _dateLike_ »).
1. Let _result_ be ? Invoke(_calendar_, *"weekOfYear"*, « _dateLike_ »).
1. If _result_ is *undefined*, return *undefined*.
1. If Type(_result_) is not Number, throw a *TypeError* exception.
1. If IsIntegralNumber(_result_) is *false*, throw a *RangeError* exception.
1. If _result_ &lt; *1*<sub>𝔽</sub>, throw a *RangeError* exception.
Expand All @@ -639,6 +640,7 @@ <h1>
1. Set _calendar_ to ! CreateTemporalCalendar(_calendar_).
1. Return ? Call(%Temporal.Calendar.prototype.yearOfWeek%, _calendar_, « _dateLike_ »).
1. Let _result_ be ? Invoke(_calendar_, *"yearOfWeek"*, « _dateLike_ »).
1. If _result_ is *undefined*, return *undefined*.
1. If Type(_result_) is not Number, throw a *TypeError* exception.
1. If IsIntegralNumber(_result_) is *false*, throw a *RangeError* exception.
1. Return ℝ(_result_).
Expand Down
9 changes: 9 additions & 0 deletions spec/intl.html
Original file line number Diff line number Diff line change
Expand Up @@ -2023,6 +2023,15 @@ <h1>
Usually the [[Year]] field will contain the same value given by CalendarDateYear, but may contain the previous or next year if the week number in the [[Week]] field overlaps two different years.
See also ToISOWeekOfYear.
</p>
<p>
It returns *undefined* in [[Week]] and [[Year]] field for calendars that do not have a well-defined week calendar system.
</p>
<emu-note type="editor">
<p>
More details about this function will be specified in
<a href="https://tc39.es/proposal-intl-era-monthcode/">the Intl era and monthCode proposal</a>.
</p>
</emu-note>
</emu-clause>

<emu-clause id="sec-temporal-calendardatedaysinweek" type="abstract operation">
Expand Down
4 changes: 2 additions & 2 deletions spec/mainadditions.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ <h1>The Year-Week Record Specification Type</h1>
<tbody>
<tr>
<td>[[Week]]</td>
<td>a positive integer</td>
<td>a positive integer or *undefined*</td>
<td>The calendar week of year.</td>
</tr>
<tr>
<td>[[Year]]</td>
<td>an integer</td>
<td>an integer or *undefined*</td>
<td>The week calendar year.</td>
</tr>
</tbody>
Expand Down

0 comments on commit 33380bd

Please sign in to comment.