Closed adipascu closed 5 months ago
Hi @adipascu, yes this is working as intended. The since/until algorithm changed recently in the Temporal spec and temporal-polyfill already caught up to those changes.
The following code will yield the same result in the tc39 temporal "playground" (open your dev console):
const now = Temporal.ZonedDateTime.from("2020-02-28T00:00:00Z[UTC]");
const birthDate = Temporal.PlainDate.from("2000-02-29");
const midnightInstant = birthDate.toZonedDateTime(now.getTimeZone());
const dur = now.since(midnightInstant)
const years = dur.total({
unit: "years",
relativeTo: midnightInstant,
});
console.log(dur.toString()); // PT175296H
console.log('years', years); // 19.997267759562842
Version 0.2.5 breaks unit tests in my app, is this working as intended?
Here is the failing test case:
https://github.com/adipascu/solid-motivation/blob/f11e818b97c816f5ec5c830dc0f63177bfd064e6/src/calculate-age.test.ts#L47