We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const endTime = dayjs.unix(1716998400).add(32, 'day'); // 2024/7/1/ 00:00:00 const now = dayjs(); // 2024/5/30 13:50:50
const duration = dayjs.duration(endTime.diff(now));
console.log(duration.hours()); // output is "0" which should be "10" // when change 32 to 30, the hours func returns 10
The text was updated successfully, but these errors were encountered:
dayjs 1.11.11
1.11.11
The problem occurs when the difference become 31 days.
const now = dayjs('2024-05-02T01:00:00'); const future30 = now.add(30, 'day'); const duration30 = dayjs.duration(future30.diff(now)); console.log(duration30.hours()); // 🆗 returns 0 console.log('iso', duration30); // "P30D" const future31 = now.add(31, 'day'); const duration31 = dayjs.duration(future31.diff(now)); console.log(duration31.hours()); // 💥 returns 14 console.log('iso', duration31); // "P1MT14H"
#1433 (comment) #2565 (comment)
Sorry, something went wrong.
No branches or pull requests
const endTime = dayjs.unix(1716998400).add(32, 'day'); // 2024/7/1/ 00:00:00
const now = dayjs(); // 2024/5/30 13:50:50
const duration = dayjs.duration(endTime.diff(now));
console.log(duration.hours());
// output is "0" which should be "10"
// when change 32 to 30, the hours func returns 10
The text was updated successfully, but these errors were encountered: