Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problema:
parseISO parses number '30' on a date with the year 3000.
const { parseISO} = require('date-fns');
console.log(parseISO('30')); // prints '3000-01-01T08:00:00.000Z'
Soluction:
Since the parseISO function in its documentation receives dates in full format (YYYY-MM-DDTHH:mm:ss.sssZ
) or dates in partial format (YYYY-MM-DD, YYYY-MM, YYYY) a code was added that sends all years with less than 4 digits to 4-digit years, this way the function correctly returns the dates as happens with entries 0001, 0030, 0999 which translates into 0001-01-01T00:00:00, 0030-01-01T00:00:00, 0999-01-01T00:00:00 respectively.
And as a reference, tests being implemented with the same purpose in Go language respond as invalid input and only allow dates in the full format.: Test in Go Lang