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

day() returns wrong value #1821

Closed
SunnyAureliusRichard opened this issue Mar 5, 2022 · 4 comments
Closed

day() returns wrong value #1821

SunnyAureliusRichard opened this issue Mar 5, 2022 · 4 comments

Comments

@SunnyAureliusRichard
Copy link

Describe the bug
I'm calling day() on a date, and it returns 6 instead of 5

Expected behavior
Should return 5

Information

  • Day.js Version: 1.10.8 and 1.10.7
  • OS: Windows
  • Browser Chrome 99.0.4844.51
  • Time zone: private

Line of code: dayjs('2022-03-05T03:40:59+00:00').day()
This one works: parseInt(dayjs(this.date).format("DD"))

@williamAstudillo
Copy link

williamAstudillo commented Mar 8, 2022

It happens to me the same but with months and it is sometimes

@SunnyAureliusRichard
Copy link
Author

This library is clearly dead, moved onto date-fns

@IgorKvasn
Copy link

I can also configrm this bug - it happens occasionaly and it is very very difficult to reproduce

@iamkun
Copy link
Owner

iamkun commented Apr 15, 2022

If you want to get the date of month, you should use dayjs().date() not dayjs().day()

image

https://day.js.org/docs/en/get-set/date

@iamkun iamkun closed this as completed Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants