Skip to content

Calendar.current.startOfDay(for: self) rounds to the hour, not the day. #66

@joshuakcockrell

Description

@joshuakcockrell
let date = Date()
let rounded = Calendar.current.startOfDay(for: date)
print("Round \(date) to \(rounded)")

iOS          output: `Round 2023-12-15 19:06:55 +0000 to 2023-12-15 07:00:00 +0000` (The 7 is the timezone I'm in)
Skip Android output: `Round 2023-12-15 19:06:55 +0000 to 2023-12-15 19:00:00 +0000` (only rounds to nearest hour)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions