Commit db865e9
committed
Fix timestamps with years before 100 being parsed as 19xx/20xx
The date and timestamp parser passed PostgreSQL's text output straight to
new Date(x). For a year below 100 such as '0050-06-15 12:30:00+00',
JavaScript's legacy date parser maps the year into the 1900s (or returns
Invalid Date), so the value was silently off by about 1900 years.
Normalize the text to ISO 8601 (space to T, two-digit timezone offset to
+HH:00) so the ISO parser is used, which handles years below 100
correctly. Years 100 and above are unaffected.1 parent e7dfa14 commit db865e9
2 files changed
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
104 | 108 | | |
105 | 109 | | |
106 | 110 | | |
| |||
0 commit comments