diff for same day (one UTC, one regular) gives 10800000
See original GitHub issueDescribe the bug UTC diff for same day gives 10800000
let dayjs = require('dayjs')
let utc = require('dayjs/plugin/utc')
dayjs.extend(utc)
console.log('diff', dayjs.utc('2021-06-07').diff('2021-06-07', 'days')) //gives 10800000. Expected: 0 or maybe 1, if timezone difference
console.log('diff', dayjs.utc('2021-06-07').diff(dayjs.utc('2021-06-07'), 'days')) //gives 0, correct
Expected behavior diff = 0 or maybe 1, if timezone difference
Information
- Day.js Version 1.8.27
- OS: Fedora
- Browser nodejs 12
- Time zone: GMT+3
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (5 by maintainers)
Top Results From Across the Web
DateAdd, DateDiff, and TimeZoneOffset functions in Power Apps
The DateDiff function returns the difference between two date/time values. The result is a whole number of units. For both functions, units can ......
Read more >Time Zone Converter – Time Difference Calculator
Time Zone Converter – Time Difference Calculator. Provides time zone conversions taking into account Daylight Saving Time (DST), local time zone and accepts ......
Read more >Difference between two time.Time objects - Stack Overflow
Question might be basic one. I have two time.Time objects and I want to get the difference between the two in terms of...
Read more >Difference
This indicates the difference between two date-time in the specified unit. To get the difference in milliseconds, use dayjs#diff .
Read more >Impala Date and Time Functions
The days value can be negative, which gives the same result as the ... For example, 11:59 PM on one day and 12:01...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

fixed
How is one supposed to calculate the difference between two timezones? Get the UTC string with format ‘Z’ and then parse int?
EDIT: got it with
.utcOffset() / 60