temporal icon indicating copy to clipboard operation
temporal copied to clipboard

Implement new Nudge changes

Open Manishearth opened this issue 1 month ago • 0 comments

https://github.com/tc39/proposal-temporal/pull/3172/

Test:

/// Test for https://github.com/tc39/proposal-temporal/pull/3172/
///
/// test262: built-ins/Temporal/Duration/prototype/total/rounding-window
#[test]
#[cfg(feature = "compiled_data")]
fn test_nudge_relative_date_total() {
    let d = Duration::new(1, 0, 0, 0, 1, 0, 0, 0, 0, 0).unwrap();
    let relative = PlainDate::new(2020, 2, 29, Calendar::ISO).unwrap();
    assert_eq!(d.total(Unit::Year, Some(relative.into())).unwrap(), 1.0001141552511414);


    let d = Duration::new(0, 1, 0, 0, 10, 0, 0, 0, 0, 0).unwrap();
    let relative = PlainDate::new(2020, 1, 31, Calendar::ISO).unwrap();
    assert_eq!(d.total(Unit::Month, Some(relative.into())).unwrap(), 1.0134408602150538);
}

(a similar test can be written based on the round test in test262)

Manishearth avatar Nov 24 '25 22:11 Manishearth