mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:07:45 +00:00
LibJS: Implement Temporal.PlainDateTime.prototype.getISOFields()
This commit is contained in:
parent
18fd0d4011
commit
080112eb82
4 changed files with 106 additions and 0 deletions
|
@ -0,0 +1,47 @@
|
|||
describe("normal behavior", () => {
|
||||
test("length is 0", () => {
|
||||
expect(Temporal.PlainDateTime.prototype.getISOFields).toHaveLength(0);
|
||||
});
|
||||
|
||||
test("basic functionality", () => {
|
||||
const calendar = new Temporal.Calendar("iso8601");
|
||||
const plainDateTime = new Temporal.PlainDateTime(
|
||||
2021,
|
||||
7,
|
||||
23,
|
||||
0,
|
||||
42,
|
||||
18,
|
||||
123,
|
||||
456,
|
||||
789,
|
||||
calendar
|
||||
);
|
||||
const fields = plainDateTime.getISOFields();
|
||||
expect(fields).toEqual({
|
||||
calendar: calendar,
|
||||
isoDay: 23,
|
||||
isoHour: 0,
|
||||
isoMicrosecond: 200,
|
||||
isoMillisecond: 123,
|
||||
isoMinute: 42,
|
||||
isoMonth: 7,
|
||||
isoNanosecond: 21,
|
||||
isoSecond: 18,
|
||||
isoYear: 2021,
|
||||
});
|
||||
// Test field order
|
||||
expect(Object.getOwnPropertyNames(fields)).toEqual([
|
||||
"calendar",
|
||||
"isoDay",
|
||||
"isoHour",
|
||||
"isoMicrosecond",
|
||||
"isoMillisecond",
|
||||
"isoMinute",
|
||||
"isoMonth",
|
||||
"isoNanosecond",
|
||||
"isoSecond",
|
||||
"isoYear",
|
||||
]);
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue