Skip to content
New issue

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

dayjs.duration(x.diff(y)) 后获取seconds()返回大于59 #865

Closed
Syntax-J opened this issue Apr 15, 2020 · 5 comments · Fixed by #867
Closed

dayjs.duration(x.diff(y)) 后获取seconds()返回大于59 #865

Syntax-J opened this issue Apr 15, 2020 · 5 comments · Fixed by #867
Labels
☢️Bug Something isn't working released

Comments

@Syntax-J
Copy link

Syntax-J commented Apr 15, 2020

Issuehunt badges

Describe the bug

let a = dayjs()
let b = dayjs().add(61, 's')
let c = dayjs.duration(b.diff(a))
console.log(c.minutes(), c.seconds())

image
image

moment表现正常
image

Expected behavior
返回0到59
Information

  • Day.js Version [1.8.24]
  • OS: [Catalina]
  • Browser [chrome 81]

IssueHunt Summary

Backers (Total: $0.00)

Become a backer now!

Or submit a pull request to get the deposits!

Tips


IssueHunt has been backed by the following sponsors. Become a sponsor

@Syntax-J Syntax-J changed the title dayjs.duration(x.diff(y).seconds()返回大于59 dayjs.duration(x.diff(y)) 后获取seconds()返回大于59 Apr 15, 2020
@iamkun iamkun added the ☢️Bug Something isn't working label Apr 15, 2020
@issuehunt-oss
Copy link

issuehunt-oss bot commented Apr 15, 2020

@iamkun has funded $1.00 to this issue.


@issuehunt-oss issuehunt-oss bot added the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label Apr 15, 2020
@issuehunt-oss
Copy link

issuehunt-oss bot commented Apr 15, 2020

@iamkun has cancelled funding for this issue.(Cancelled amount: $1.00) See it on IssueHunt

@issuehunt-oss issuehunt-oss bot removed the 💵 Funded on Issuehunt This issue has been funded on Issuehunt label Apr 15, 2020
@CatsMiaow
Copy link
Contributor

dayjs v1.8.24
minutes() same problem

const time = dayjs.duration(12345, 's');
console.log(time.hours(), time.minutes(), time.seconds());
// 3 205 12345

@iamkun
Copy link
Owner

iamkun commented Apr 18, 2020

@CatsMiaow Fixed in #867

@iamkun
Copy link
Owner

iamkun commented Apr 21, 2020

🎉 This issue has been resolved in version 1.8.25 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
☢️Bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants