New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3763 parse iso fix #3780
base: main
Are you sure you want to change the base?
3763 parse iso fix #3780
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,10 @@ | |
|
||
describe("parseISO", () => { | ||
describe("string argument", () => { | ||
describe("centuries", () => { | ||
describe("years", () => { | ||
it("parses YY", () => { | ||
const result = parseISO("20"); | ||
expect(result).toEqual(new Date(2000, 0 /* Jan */, 1)); | ||
expect(result.getUTCFullYear()).toEqual(19); | ||
Check failure on line 9 in src/parseISO/test.ts GitHub Actions / testssrc/parseISO/test.ts > parseISO > string argument > years > parses YY
Check failure on line 9 in src/parseISO/test.ts GitHub Actions / tests (18)src/parseISO/test.ts > parseISO > string argument > years > parses YY
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please compare with a full date like before, as it prevents other date components from being parsed incorrectly. |
||
}); | ||
}); | ||
|
||
|
@@ -112,11 +112,8 @@ | |
}); | ||
|
||
it("allows to specify the number of additional digits", () => { | ||
const result = parseISO("-20", { additionalDigits: 0 }); | ||
const date = new Date(0); | ||
date.setFullYear(-2000, 0 /* Jan */, 1); | ||
date.setHours(0, 0, 0, 0); | ||
expect(result).toEqual(date); | ||
const result = parseISO("20", { additionalDigits: 0 }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I prefer to keep the tests as is and update/add only what is required. Here, it needs to be clarified how these changes relate to the PR goal. |
||
expect(result.getUTCFullYear()).toEqual(19); | ||
Check failure on line 116 in src/parseISO/test.ts GitHub Actions / testssrc/parseISO/test.ts > parseISO > string argument > extended century representation > allows to specify the number of additional digits
Check failure on line 116 in src/parseISO/test.ts GitHub Actions / tests (18)src/parseISO/test.ts > parseISO > string argument > extended century representation > allows to specify the number of additional digits
Check failure on line 116 in src/parseISO/test.ts GitHub Actions / tests (20)src/parseISO/test.ts > parseISO > string argument > extended century representation > allows to specify the number of additional digits
|
||
}); | ||
}); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use
addLeadingZeros
fromsrc/_lib/addLeadingZero/index.ts