-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Labels
C-bugSomething isn't workingSomething isn't working
Description
I've run into a JS case that gives incorrect results with V8, but not with Boa. I'm not sure what Boa is doing differently to avoid the bug, but I can reproduce it when writing Rust code directly, so the underlying issue must be with temporal_rs.
Reproducer:
let duration = Duration::new(0, 0, 0, 0, 48, 0, 0, 0, 0, 0).unwrap();
let relative_to = ZonedDateTime::try_new(0_i128, TimeZone::utc(), Calendar::ISO).unwrap();
let result = duration.round_with_provider(
RoundingOptions {
smallest_unit: Some(Unit::Day),
increment: Some(RoundingIncrement::new_unchecked(NonZeroU32::new(2).unwrap())),
..Default::default()
},
Some(RelativeTo::ZonedDateTime(relative_to)),
&*crate::builtins::TZ_PROVIDER,
).unwrap();
assert_eq!(result.days(), 2);JS code that triggers the bug:
const d = new Temporal.Duration(0, 0, 0, 0, 48);
d.round({ smallestUnit: 'days', roundingIncrement: 2 }).toString() // "P2D"
d.round({ smallestUnit: 'days', roundingIncrement: 2, relativeTo: new Temporal.ZonedDateTime(0n, 'UTC') }).toString()
// "P4D", should be "P2D"The inclusion of relativeTo here should make no difference, since UTC has no time zone transitions.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugSomething isn't workingSomething isn't working
Type
Projects
Status
No status