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

Fix date test to work on Oct 20 (#27575)

* Fix date test to work on Oct 20

* tweak
This commit is contained in:
Petar Petrov
2025-10-20 13:39:04 +03:00
committed by GitHub
parent e3a1d0abe2
commit e432f0a8ee

View File

@@ -24,10 +24,16 @@ describe("absoluteTime", () => {
it("should format date correctly for same year", () => {
const from = new Date();
from.setUTCMonth(9, 20);
from.setUTCHours(13, 23);
const result = absoluteTime(from, locale, config);
expect(result).toBe("Oct 20, 13:23");
if (from.getUTCMonth() === 9 && from.getUTCDate() === 20) {
from.setUTCMonth(10, 20);
const result = absoluteTime(from, locale, config);
expect(result).toBe("Nov 20, 13:23");
} else {
from.setUTCMonth(9, 20);
const result = absoluteTime(from, locale, config);
expect(result).toBe("Oct 20, 13:23");
}
});
it("should format date with year correctly", () => {