Date getTime unexpected result
- Dominant language
- JavaScript
- Stars
- 11.3k
- Forks
- 859
- Avg merge
- 1h 30m
- Merged PRs (30d)
- 3
Description
## Bug Description
There is a discrepency between how Hermes compute dates and how chrome V8 does it.
The following code does not provide the same result:
Code:
```
const testDate = new Date(0)
console.log('=====>', testDate.getTime())
testDate.setSeconds(0)
console.log('=====>', testDate.getTime())
```
Output with hermes:
Output in chrome console:
- [x] I have run `gradle clean` and confirmed this bug does not occur with JSC
- [ ] The issue is reproducible with the latest version of React Native.
Hermes git revision (if applicable):
React Native version: 0.74.0
OS: ios and android
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64):
## Steps To Reproduce
NA
code example:
```
const testDate = new Date(0)
console.log('=====>', testDate.getTime())
testDate.setSeconds(0)
console.log('=====>', testDate.getTime())
```
## The Expected Behavior
`getTime` should return `0`
Contributor guide
Research direction
Start with the provided Date example and run it in Hermes and Chrome/V8 on both iOS and Android, confirming the differing getTime result after setSeconds(0). Trace the Date mutation and time-value calculation, then verify that getTime returns 0 and matches V8; the report notes React Native 0.74.0 and that the issue does not occur with JSC.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100