Skip to content

Commit ce5dd91

Browse files
committed
Remove unwrap in PYM::epoch_ns_for_utc
1 parent dbd731d commit ce5dd91

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/builtins/core/plain_year_month.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,10 +618,11 @@ impl PlainYearMonth {
618618
// Useful for implementing HandleDateTimeTemporalYearMonth
619619
pub fn epoch_ns_for_utc(&self) -> EpochNanoseconds {
620620
// 2. Let isoDateTime be CombineISODateAndTimeRecord(temporalYearMonth.[[ISODate]], NoonTimeRecord()).
621-
let iso = IsoDateTime::new(self.iso, IsoTime::noon());
622-
debug_assert!(iso.is_ok());
621+
// new_unchecked: PYM is supposed to support year-months outside of the ISO range as well as long
622+
// as the year is in range
623+
let iso = IsoDateTime::new_unchecked(self.iso, IsoTime::noon());
623624
// 3. Let epochNs be ? GetUTCEpochNanoseconds(isoDateTime).
624-
iso.unwrap_or_default().as_nanoseconds()
625+
iso.as_nanoseconds()
625626
}
626627

627628
/// Returns a RFC9557 IXDTF string for the current `PlainYearMonth`

0 commit comments

Comments
 (0)