-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Closed
Description
In recent release it looks like Date-FNS package was removed and TypeOrm is doing it's own parsing but the calculation for calculation is problematic.
In src/util/DateUtils.ts this method was added to replace date-fns.parseISO
private static parseDateAsISO(dateString: string): Date {
const date = new Date(dateString)
const offset = date.getTimezoneOffset() * 60 * 1000
const utc = date.getTime() + offset
return new Date(utc)
}
However the above code returns the datetime with wrong values.
Example:
Given this string: '2023-04-11T16:56:57.572Z'
The above function returns: '2023-04-11T23:56:57.572Z' depending on what timezone your environment is configured for, this example it is -07:00.
Where as date-fns.parseISO() returns: '2023-04-11T16:56:57.572Z' which seems correct.
fdundjer, ColiZei, henrinormak, danewilson, felix-gohla and 1 more
Metadata
Metadata
Assignees
Labels
No labels