Date before 0001-01-01 is not properly parsed
- Dominant language
- JavaScript
- Stars
- 48.7k
- Forks
- 2.5k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
When calling val1.toISOString(), returned value is `0001-01-01T00:15:28.000Z`
```
var assert = require('assert');
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc');
const timezone = require('dayjs/plugin/timezone');
dayjs.extend(utc); dayjs.extend(timezone);
dayjs.tz.setDefault("America/Toronto");
minDate = "0001-01-01T00:00:00.000Z";
val1 = dayjs.tz(dayjs(minDate));
assert(minDate === val1.toISOString());
// value is "0001-01-01T00:15:28.000Z"
// instead of "0001-01-01T00:00:00.000Z"
```
**Expected behavior**
Returned value should be `0001-01-01T00:00:00.000Z`
**Information**
- Day.js Version 1.11.7
- OS: Windows 10
- Browser N/A Node v18.15.0
- Time zone: [e.g. GMT-04:00 EDT (Eastern Daylight Saving Time)]
Contributor guide
Assessment
This issue has not been assessed yet.