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

Incorrect weekday Int value for non-Sunday start of week #826

Open
andy3a1 opened this issue Aug 7, 2024 · 0 comments
Open

Incorrect weekday Int value for non-Sunday start of week #826

andy3a1 opened this issue Aug 7, 2024 · 0 comments

Comments

@andy3a1
Copy link

andy3a1 commented Aug 7, 2024

by default different Calendar.Identifier values have different Calendar.current.firstWeekday.
Also there is a possibility to choose any day as start of week in Settings.
image

Suggesting to change this code

var weekday: Int { return dateComponents.weekday! }

by adding dependency on Calendar.current.firstWeekday

var weekday: Int { return (dateComponents.weekday! - Calendar.current.firstWeekday + 7) % 7 + 1 }

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