Apologies for this rounding/diffing nitpicking. Repro:
const duration = new Temporal.Duration(1, 0, 0, 0, 24)
const past = Temporal.ZonedDateTime.from("2019-11-01T00:00[America/Vancouver]")
const future = past.add(duration)
const durationViaUntil = past.until(future, {
largestUnit: 'years',
})
console.log(durationViaUntil.toString())
// "P1YT24H" (desired b/c of DST)
const durationViaRound = duration.round({
largestUnit: 'years',
relativeTo: past,
})
console.log(durationViaRound.toString())
// "P1Y1D" (undesired)
Precedents:
ZonedDateTime::add adds Y/M/W/D before time parts
ZonedDateTime::until diffs Y/M/W/D before time parts
It would make sense to have Duration::round effectively add Y/M/W/D to relativeTo before balancing time parts up to days (NanosecondsToDays). This is currently not possible because the Duration::round methods calls BalanceTimeDurationRelative before BalanceDateDurationRelative. (see here)
Encountered while working with this test:
intl402/Temporal/Duration/prototype/round/relativeto-string-datetime.js
Similar to:
#2563
#2715
Apologies for this rounding/diffing nitpicking. Repro:
Precedents:
ZonedDateTime::addadds Y/M/W/D before time partsZonedDateTime::untildiffs Y/M/W/D before time partsIt would make sense to have
Duration::roundeffectively add Y/M/W/D to relativeTo before balancing time parts up to days (NanosecondsToDays). This is currently not possible because theDuration::roundmethods callsBalanceTimeDurationRelativebeforeBalanceDateDurationRelative. (see here)Encountered while working with this test:
intl402/Temporal/Duration/prototype/round/relativeto-string-datetime.js
Similar to:
#2563
#2715