mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-02 14:19:48 +00:00
LibJS: Handle ZonedDateTime in ToTemporalDate
This commit is contained in:
parent
6f75dcc7b8
commit
4640643019
Notes:
sideshowbarker
2024-07-18 07:38:05 +09:00
Author: https://github.com/linusg
Commit: 4640643019
Pull-request: https://github.com/SerenityOS/serenity/pull/9160
Reviewed-by: https://github.com/IdanHo ✅
2 changed files with 34 additions and 4 deletions
|
@ -11,6 +11,23 @@ describe("correct behavior", () => {
|
|||
expect(createdPlainDate.day).toBe(26);
|
||||
});
|
||||
|
||||
test("PlainDateTime instance argument", () => {
|
||||
const plainDateTime = new Temporal.PlainDateTime(2021, 7, 26, 1, 2, 3);
|
||||
const createdPlainDate = Temporal.PlainDate.from(plainDateTime);
|
||||
expect(createdPlainDate.year).toBe(2021);
|
||||
expect(createdPlainDate.month).toBe(7);
|
||||
expect(createdPlainDate.day).toBe(26);
|
||||
});
|
||||
|
||||
test("ZonedDateTime instance argument", () => {
|
||||
const timeZone = new Temporal.TimeZone("UTC");
|
||||
const zonedDateTime = new Temporal.ZonedDateTime(1627318123456789000n, timeZone);
|
||||
const createdPlainDate = Temporal.PlainDate.from(zonedDateTime);
|
||||
expect(createdPlainDate.year).toBe(2021);
|
||||
expect(createdPlainDate.month).toBe(7);
|
||||
expect(createdPlainDate.day).toBe(26);
|
||||
});
|
||||
|
||||
// Un-skip once ParseISODateTime & ParseTemporalDateString are implemented
|
||||
test.skip("PlainDate string argument", () => {
|
||||
const createdPlainDate = Temporal.PlainDate.from("2021-07-26");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue