Skip to content

Commit

Permalink
Emit reference information when calendarName = 'always'
Browse files Browse the repository at this point in the history
closes tc39#1971
  • Loading branch information
jessealama authored and ptomato committed Mar 30, 2022
1 parent 6cf421b commit 32bf5d3
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions polyfill/lib/ecmascript.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2093,7 +2093,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 @@ -2107,7 +2107,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 polyfill/test262
Submodule test262 updated 79 files
+1 −1 .jshintrc
+1 −1 test/built-ins/ShadowRealm/WrappedFunction/throws-typeerror-on-revoked-proxy.js
+1 −1 test/built-ins/ShadowRealm/prototype/evaluate/throws-typeerror-wrap-throwing.js
+17 −25 test/built-ins/String/prototype/localeCompare/15.5.4.9_CE.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/dateAdd/argument-string-invalid.js
+8 −3 test/built-ins/Temporal/Calendar/prototype/dateAdd/overflow-invalid-string.js
+9 −3 test/built-ins/Temporal/Calendar/prototype/dateFromFields/overflow-invalid-string.js
+67 −0 test/built-ins/Temporal/Calendar/prototype/dateUntil/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/day/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/dayOfWeek/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/dayOfYear/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/daysInMonth/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/daysInWeek/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/daysInYear/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/inLeapYear/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/month/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/monthCode/argument-string-invalid.js
+8 −1 test/built-ins/Temporal/Calendar/prototype/monthDayFromFields/overflow-invalid-string.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/monthsInYear/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/weekOfYear/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/Calendar/prototype/year/argument-string-invalid.js
+40 −0 test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/basic.js
+11 −9 test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/branding.js
+22 −0 test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/fields-missing-properties.js
+1 −1 test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/fields-not-object.js
+31 −0 test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/monthcode-invalid.js
+17 −0 test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/options-not-object.js
+91 −0 test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/overflow-constrain.js
+8 −1 test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/overflow-invalid-string.js
+26 −0 test/built-ins/Temporal/Calendar/prototype/yearMonthFromFields/overflow-reject.js
+33 −0 test/built-ins/Temporal/Duration/compare/twenty-five-hour-day.js
+39 −0 test/built-ins/Temporal/Duration/prototype/abs/basic.js
+51 −0 test/built-ins/Temporal/Duration/prototype/negated/basic.js
+240 −0 test/built-ins/Temporal/Duration/prototype/toJSON/basic.js
+93 −0 test/built-ins/Temporal/Duration/prototype/with/all-negative.js
+92 −0 test/built-ins/Temporal/Duration/prototype/with/all-positive.js
+31 −0 test/built-ins/Temporal/Duration/prototype/with/argument-object-wrong-shape.js
+27 −0 test/built-ins/Temporal/Duration/prototype/with/argument-wrong-type.js
+11 −9 test/built-ins/Temporal/Duration/prototype/with/branding.js
+86 −0 test/built-ins/Temporal/Duration/prototype/with/partial-positive.js
+28 −0 test/built-ins/Temporal/Duration/prototype/with/sign-conflict-throws-rangeerror.js
+66 −0 test/built-ins/Temporal/PlainDate/compare/argument-string-invalid.js
+53 −23 test/built-ins/Temporal/PlainDate/from/argument-string-invalid.js
+30 −0 test/built-ins/Temporal/PlainDate/from/observable-get-overflow-argument-string-invalid.js
+0 −0 test/built-ins/Temporal/PlainDate/from/observable-get-overflow-argument-string.js
+11 −5 test/built-ins/Temporal/PlainDate/from/overflow-invalid-string.js
+8 −2 test/built-ins/Temporal/PlainDate/prototype/add/overflow-invalid-string.js
+61 −0 test/built-ins/Temporal/PlainDate/prototype/equals/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/PlainDate/prototype/since/argument-string-invalid.js
+8 −2 test/built-ins/Temporal/PlainDate/prototype/subtract/overflow-invalid-string.js
+61 −0 test/built-ins/Temporal/PlainDate/prototype/until/argument-string-invalid.js
+9 −3 test/built-ins/Temporal/PlainDate/prototype/with/overflow-invalid-string.js
+11 −3 test/built-ins/Temporal/PlainDateTime/from/overflow-invalid-string.js
+4 −3 test/built-ins/Temporal/PlainDateTime/prototype/add/overflow-invalid-string.js
+8 −1 test/built-ins/Temporal/PlainDateTime/prototype/subtract/overflow-invalid-string.js
+6 −4 test/built-ins/Temporal/PlainDateTime/prototype/with/overflow-invalid-string.js
+61 −0 test/built-ins/Temporal/PlainDateTime/prototype/withPlainDate/argument-string-invalid.js
+24 −0 test/built-ins/Temporal/PlainMonthDay/calendar-always.js
+11 −3 test/built-ins/Temporal/PlainMonthDay/from/overflow-invalid-string.js
+2 −2 test/built-ins/Temporal/PlainMonthDay/prototype/toString/calendarname-always.js
+8 −2 test/built-ins/Temporal/PlainMonthDay/prototype/with/overflow-invalid-string.js
+0 −0 test/built-ins/Temporal/PlainTime/from/observable-get-overflow-argument-string-invalid.js
+11 −5 test/built-ins/Temporal/PlainTime/from/overflow-invalid-string.js
+61 −0 test/built-ins/Temporal/PlainTime/prototype/toPlainDateTime/argument-string-invalid.js
+61 −0 test/built-ins/Temporal/PlainTime/prototype/toZonedDateTime/argument-string-invalid.js
+8 −2 test/built-ins/Temporal/PlainTime/prototype/with/overflow-invalid-string.js
+24 −0 test/built-ins/Temporal/PlainYearMonth/calendar-always.js
+11 −5 test/built-ins/Temporal/PlainYearMonth/from/overflow-invalid-string.js
+8 −2 test/built-ins/Temporal/PlainYearMonth/prototype/add/overflow-invalid-string.js
+8 −2 test/built-ins/Temporal/PlainYearMonth/prototype/subtract/overflow-invalid-string.js
+1 −1 test/built-ins/Temporal/PlainYearMonth/prototype/toString/calendarname-always.js
+8 −2 test/built-ins/Temporal/PlainYearMonth/prototype/with/overflow-invalid-string.js
+11 −3 test/built-ins/Temporal/ZonedDateTime/from/overflow-invalid-string.js
+8 −1 test/built-ins/Temporal/ZonedDateTime/prototype/add/overflow-invalid-string.js
+8 −1 test/built-ins/Temporal/ZonedDateTime/prototype/subtract/overflow-invalid-string.js
+8 −1 test/built-ins/Temporal/ZonedDateTime/prototype/with/overflow-invalid-string.js
+61 −0 test/built-ins/Temporal/ZonedDateTime/prototype/withPlainDate/argument-string-invalid.js
+61 −0 test/intl402/Temporal/Calendar/prototype/era/argument-string-invalid.js
+61 −0 test/intl402/Temporal/Calendar/prototype/eraYear/argument-string-invalid.js
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 *"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 @@ -685,7 +685,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 *"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 32bf5d3

Please sign in to comment.