diff --git a/src/builtins/core/month_day.rs b/src/builtins/core/month_day.rs index 226f046a4..293daee5e 100644 --- a/src/builtins/core/month_day.rs +++ b/src/builtins/core/month_day.rs @@ -126,6 +126,15 @@ impl FromStr for PlainMonthDay { .transpose()? .unwrap_or_default(); + // ParseISODateTime + // Step 4.a.ii.3 + // If goal is TemporalMonthDayString or TemporalYearMonthString, calendar is + // not empty, and the ASCII-lowercase of calendar is not "iso8601", throw a + // RangeError exception. + if !calendar.is_iso() { + return Err(TemporalError::range().with_message("non-ISO calendar not supported.")); + } + let date = record.date; let date = date.temporal_unwrap()?; diff --git a/src/builtins/core/year_month.rs b/src/builtins/core/year_month.rs index 632b31db8..547a7a03c 100644 --- a/src/builtins/core/year_month.rs +++ b/src/builtins/core/year_month.rs @@ -262,6 +262,15 @@ impl FromStr for PlainYearMonth { .transpose()? .unwrap_or_default(); + // ParseISODateTime + // Step 4.a.ii.3 + // If goal is TemporalMonthDayString or TemporalYearMonthString, calendar is + // not empty, and the ASCII-lowercase of calendar is not "iso8601", throw a + // RangeError exception. + if !calendar.is_iso() { + return Err(TemporalError::range().with_message("non-ISO calendar not supported.")); + } + let date = record.date.temporal_unwrap()?; // The below steps are from `ToTemporalYearMonth` @@ -316,6 +325,7 @@ mod tests { "+275760-10", "+275760-10-01", "+275760-10-01T00:00", + "1976-11[u-ca=hebrew]", ]; for invalid_case in invalid_strings {