Skip to content

Commit

Permalink
Patch (un)balance_relative to avoid panicking
Browse files Browse the repository at this point in the history
  • Loading branch information
jedel1043 committed Jun 16, 2024
1 parent 81278bd commit e865715
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/components/duration/date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
Duration,
},
options::{ArithmeticOverflow, RelativeTo, TemporalRoundingMode, TemporalUnit},
utils, TemporalError, TemporalResult, NS_PER_DAY,
utils, TemporalError, TemporalResult, TemporalUnwrap, NS_PER_DAY,
};

use super::normalized::NormalizedTimeDuration;
Expand Down Expand Up @@ -63,7 +63,7 @@ impl DateDuration {
context: &mut C::Context,
) -> TemporalResult<Self> {
// 1. Assert: If plainRelativeTo is not undefined, calendarRec is not undefined.
let plain_relative = plain_relative_to.expect("plainRelativeTo must not be undefined.");
let plain_relative = plain_relative_to.temporal_unwrap()?;

// 2. Let defaultLargestUnit be DefaultTemporalLargestUnit(years, months, weeks, days, 0, 0, 0, 0, 0).
let default_largest = self.default_largest_unit();
Expand Down Expand Up @@ -187,7 +187,7 @@ impl DateDuration {
) -> TemporalResult<DateDuration> {
// TODO: Confirm 1 or 5 based off response to issue.
// 1. Assert: If plainRelativeTo is not undefined, calendarRec is not undefined.
let plain_relative = plain_relative_to.expect("plainRelativeTo must not be undefined.");
let plain_relative = plain_relative_to.temporal_unwrap()?;

// 2. Let allZero be false.
// 3. If years = 0, and months = 0, and weeks = 0, and days = 0, set allZero to true.
Expand Down

0 comments on commit e865715

Please sign in to comment.