1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00

Add custom selectUnit, use in relativeTime function (#14008)

This commit is contained in:
Michael Varrieur
2022-10-10 10:26:02 -04:00
committed by GitHub
parent 08279f35cf
commit 0c800344d2
5 changed files with 106 additions and 12 deletions

View File

@@ -112,4 +112,12 @@ describe("relativeTime", () => {
"1 month"
);
});
it("handles a jump between years", () => {
const inputdt = new Date("2021-12-29");
const compare = new Date("2022-01-01");
assert.strictEqual(relativeTime(inputdt, locale, compare), "3 days ago");
assert.strictEqual(relativeTime(inputdt, locale, compare, false), "3 days");
});
});