-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2190ae7
commit 894e466
Showing
1 changed file
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { EventRenderingUtils } from "./EventUtils" | ||
|
||
describe("dateTimeLocalPlaceHolder", () => { | ||
it("should return a formatted string in ISO 8601 format without milliseconds", () => { | ||
const date = new Date("2024-11-01T23:34:15.123Z") | ||
const result = EventRenderingUtils.dateTimeLocalPlaceHolder(date) | ||
expect(result).toBe("2024-11-01T23:34:15") | ||
}) | ||
|
||
it("should handle dates without milliseconds correctly", () => { | ||
const date = new Date("2024-11-01T23:34:15Z") | ||
const result = EventRenderingUtils.dateTimeLocalPlaceHolder(date) | ||
expect(result).toBe("2024-11-01T23:34:15") | ||
}) | ||
|
||
it("should handle different time zones correctly", () => { | ||
const date = new Date("2024-11-01T23:34:15.123+09:00") | ||
const result = EventRenderingUtils.dateTimeLocalPlaceHolder(date) | ||
expect(result).toBe("2024-11-01T14:34:15") | ||
}) | ||
|
||
it("should handle leap years correctly", () => { | ||
const date = new Date("2024-02-29T23:34:15.123Z") | ||
const result = EventRenderingUtils.dateTimeLocalPlaceHolder(date) | ||
expect(result).toBe("2024-02-29T23:34:15") | ||
}) | ||
|
||
it("should handle dates before 1970 correctly", () => { | ||
const date = new Date("1969-12-31T23:34:15.123Z") | ||
const result = EventRenderingUtils.dateTimeLocalPlaceHolder(date) | ||
expect(result).toBe("1969-12-31T23:34:15") | ||
}) | ||
}) |