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

isoWeekday(x) doesn't get next day of week, but previous #2035

Open
mariusa opened this issue Aug 21, 2022 · 0 comments
Open

isoWeekday(x) doesn't get next day of week, but previous #2035

mariusa opened this issue Aug 21, 2022 · 0 comments

Comments

@mariusa
Copy link

mariusa commented Aug 21, 2022

Describe the bug
isoWeekday(x) doesn't get next day of week, but previous, at least when that day already passed

Expected behavior
Similar to https://day.js.org/docs/en/get-set/weekday

dayjs().weekday(5) // next Friday (5th day after Sunday)

Today, Sunday, it behaves like this:

dayjs().format('YYYY-MM-DD')
'2022-08-21'

dayjs().isoWeekday(7).format('YYYY-MM-DD')
'2022-08-21' // correct, first possible Sunday is today.

dayjs().isoWeekday(5).format('YYYY-MM-DD')
'2022-08-19' // bug.  Next or first possible Friday is on 08-26. If I wanted the previous Friday, I would have used dayjs().isoWeekday(-5)

Information

  • Day.js Version "version": "1.11.4",
  • OS: linux
  • Browser chrome 102
  • Time zone: GMT+2
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

1 participant