Skip to content

Commit f883736

Browse files
committed
Calendar in PlainTime/-YearMonth, & -MonthDay
Port of tc39/proposal-temporal#1950
1 parent 39fc0b2 commit f883736

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/validStrings.mjs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,9 +291,9 @@ const timeSpecSeparator = seq(dateTimeSeparator, timeSpec);
291291
const dateSpecMonthDay = seq(['--'], dateMonth, ['-'], dateDay);
292292
const dateSpecYearMonth = seq(dateYear, ['-'], dateMonth);
293293
const date = choice(seq(dateYear, '-', dateMonth, '-', dateDay), seq(dateYear, dateMonth, dateDay));
294-
const time = seq(timeSpec, [timeZone]);
295294
const dateTime = seq(date, [timeSpecSeparator], [timeZone]);
296295
const calendarDateTime = seq(dateTime, [calendar]);
296+
const calendarTime = seq(timeSpec, [timeZone], [calendar]);
297297

298298
const durationFractionalPart = withCode(between(1, 9, digit()), (data, result) => {
299299
const fraction = result.padEnd(9, '0');
@@ -353,10 +353,10 @@ const goals = {
353353
Date: calendarDateTime,
354354
DateTime: calendarDateTime,
355355
Duration: duration,
356-
MonthDay: choice(dateSpecMonthDay, dateTime),
357-
Time: choice(time, dateTime),
356+
MonthDay: choice(dateSpecMonthDay, calendarDateTime),
357+
Time: choice(calendarTime, calendarDateTime),
358358
TimeZone: choice(temporalTimeZoneIdentifier, seq(date, [timeSpecSeparator], timeZone, [calendar])),
359-
YearMonth: choice(dateSpecYearMonth, dateTime),
359+
YearMonth: choice(dateSpecYearMonth, calendarDateTime),
360360
ZonedDateTime: zonedDateTime
361361
};
362362

@@ -378,10 +378,10 @@ const comparisonItems = {
378378
'microseconds',
379379
'nanoseconds'
380380
],
381-
MonthDay: ['month', 'day'],
382-
Time: timeItems,
381+
MonthDay: ['month', 'day', 'calendar'],
382+
Time: [...timeItems, 'calendar'],
383383
TimeZone: ['offset', 'ianaName'],
384-
YearMonth: ['year', 'month'],
384+
YearMonth: ['year', 'month', 'calendar'],
385385
ZonedDateTime: [...dateItems, ...timeItems, 'offset', 'ianaName', 'calendar']
386386
};
387387
const plainModes = ['Date', 'DateTime', 'MonthDay', 'Time', 'YearMonth'];

0 commit comments

Comments
 (0)