Skip to content

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

@andy3a1

Description

@andy3a1

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 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions