-
Notifications
You must be signed in to change notification settings - Fork 760
Open
Labels
Description
Hi guys,
I've noticed an issue with toRelative
with the padding
option.
Before I try to explain anything, I simply added some tests to illustrate the issue best:
// works as expected
expect(base.plus({ minutes: 1, seconds: 30 }).toRelative({ base, padding: 30000 })).toBe(
"in 2 minutes"
);
// doesn't work
expect(base.plus({ seconds: 29 }).toRelative({ base, padding: 30000 })).toBe("in 29 seconds");
Test result:
● DateTime#toRelative allows padding
expect(received).toBe(expected) // Object.is equality
Expected: "in 29 seconds"
Received: "in 59 seconds"
39 | "in 2 minutes"
40 | );
> 41 | expect(base.plus({ seconds: 29 }).toRelative({ base, padding: 30000 })).toBe("in 29 seconds");
| ^
42 | });