Skip to content

Commit

Permalink
Emit reference information when calendarName = 'always'
Browse files Browse the repository at this point in the history
closes #1971
  • Loading branch information
jessealama committed Feb 7, 2022
1 parent e51a281 commit 997f595
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2136,7 +2136,7 @@ export const ES = ObjectAssign({}, ES2020, {
let resultString = `${month}-${day}`;
const calendar = GetSlot(monthDay, CALENDAR);
const calendarID = ES.ToString(calendar);
if (calendarID !== 'iso8601') {
if (showCalendar === 'always' || calendarID !== 'iso8601') {
const year = ES.ISOYearString(GetSlot(monthDay, ISO_YEAR));
resultString = `${year}-${resultString}`;
}
Expand All @@ -2150,7 +2150,7 @@ export const ES = ObjectAssign({}, ES2020, {
let resultString = `${year}-${month}`;
const calendar = GetSlot(yearMonth, CALENDAR);
const calendarID = ES.ToString(calendar);
if (calendarID !== 'iso8601') {
if (showCalendar === 'always' || calendarID !== 'iso8601') {
const day = ES.ISODateTimePartString(GetSlot(yearMonth, ISO_DAY));
resultString += `-${day}`;
}
Expand Down
2 changes: 1 addition & 1 deletion spec/plainmonthday.html
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ <h1>TemporalMonthDayToString ( _monthDay_, _showCalendar_ )</h1>
1. Let _day_ be _monthDay_.[[ISODay]] formatted as a two-digit decimal number, padded to the left with a zero if necessary.
1. Let _result_ be the string-concatenation of _month_, the code unit 0x002D (HYPHEN-MINUS), and _day_.
1. Let _calendarID_ be ? ToString(_monthDay_.[[Calendar]]).
1. If _calendarID_ is not *"iso8601"*, then
1. If _showCalendar_ is not *"always"* or if _calendarID_ is not *"iso8601"*, then
1. Let _year_ be ! PadISOYear(_monthDay_.[[ISOYear]]).
1. Set _result_ to the string-concatenation of _year_, the code unit 0x002D (HYPHEN-MINUS), and _result_.
1. Let _calendarString_ be ! FormatCalendarAnnotation(_calendarID_, _showCalendar_).
Expand Down
2 changes: 1 addition & 1 deletion spec/plainyearmonth.html
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ <h1>TemporalYearMonthToString ( _yearMonth_, _showCalendar_ )</h1>
1. Let _month_ be _yearMonth_.[[ISOMonth]] formatted as a two-digit decimal number, padded to the left with a zero if necessary.
1. Let _result_ be the string-concatenation of _year_, the code unit 0x002D (HYPHEN-MINUS), and _month_.
1. Let _calendarID_ be ? ToString(_yearMonth_.[[Calendar]]).
1. If _calendarID_ is not *"iso8601"*, then
1. If _showCalendar_ is not *"always" or if *_calendarID_ is not *"iso8601"*, then
1. Let _day_ be _yearMonth_.[[ISODay]] formatted as a two-digit decimal number, padded to the left with a zero if necessary.
1. Set _result_ to the string-concatenation of _result_, the code unit 0x002D (HYPHEN-MINUS), and _day_.
1. Let _calendarString_ be ! FormatCalendarAnnotation(_calendarID_, _showCalendar_).
Expand Down

0 comments on commit 997f595

Please sign in to comment.