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

wrong behavior of isoWeekday() #1653

Open
Hugoist opened this issue Oct 1, 2021 · 2 comments
Open

wrong behavior of isoWeekday() #1653

Hugoist opened this issue Oct 1, 2021 · 2 comments

Comments

@Hugoist
Copy link

Hugoist commented Oct 1, 2021

Describe the bug

dayjs('random srting').isoWeekday()
returns 7

Expected behavior
It should returns NaN (as it do dayjs('random srting').day())

Information

  • Day.js Version [v1.10.7]
  • OS: [linux Mint 20.2]
  • Browser [chrome 92.0.4515.159]
  • Time zone: [GMT+0300 (Eastern European Summer Time))]
@mandaputtra
Copy link

This behaviour is intended,

// the implementation
  proto.isoWeekday = function(week) {
    if (!this.$utils().u(week)) {
      return this.day(this.day() % 7 ? week : week - 7)
    }
    return this.day() || 7
  }

@Hugoist
Copy link
Author

Hugoist commented Oct 2, 2021

Why it is 7?

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

2 participants