iamkun / iamkun/dayjs

valueOf function returns the unix timestamp with timezone difference

Open
#2,833 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
We are replacing all our components using `momentjs` library with `dayjs` library.
I'm trying to get the unix timestamp of the given date, but I'm getting the timestamp with timezone difference. For example, I've used the example given here https://day.js.org/docs/en/display/unix-timestamp-milliseconds, as mentioned in example

`dayjs('2019-01-25').valueOf()`

**Expected behavior**
As mentioned in the page, it should return the result `1548381600000`. But I'm getting `1548354600000` which is `24, Januaray 2019`.

**Information**
- Day.js Version - 1.11.13
- OS: MacOS 15.3.1
- Browser: Chrome 133.0.6943.142
- Time zone: GTM+05:30 (Indian Standard Time)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.