new Date() not throwing an Invalid Date error
- Dominant language
- JavaScript
- Stars
- 11.3k
- Forks
- 859
- Avg merge
- 1h 30m
- Merged PRs (30d)
- 3
Description
## Bug Description
When calling new Date() with a stringified date that contains '00', instead of throwing me an error it converts it to a previous date.

- [x] I have run `gradle clean` and confirmed this bug does not occur with JSC
Hermes version: 0.12
React Native version (if any): 0.71.13
OS version (if any): 16.4
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): x86_64
## Steps To Reproduce
1. Call `new Date()` with a date that contains a '00' in the string. Ex new Date('1999-00-00')
code example:
## The Expected Behavior
Should throw an 'Invalid Date' error
## Actual Behavior
Returns 1998-11-30T00:00:00.000Z (as shown in the screenshot)
Contributor guide
Research direction
Start by reproducing new Date('1999-00-00') in Hermes and compare its result with JSC, as described in the issue. Trace the date-string parsing entry point and verify that inputs containing zero month or day produce the expected Invalid Date result rather than being normalized to a previous date.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100