raymondjavaxx/calendardate
Calendar dates for Swift, built around [DateComponents](https://developer.apple.com/documentation/foundation/datecomponents). Provides value objects for representing dates and times that are not directly bound to specific UTC offsets or timezones. This is useful when [working wit
How to use it
You can initialize a CalendarDateTime value directly and convert it to a Swift Date when you need to display it to the user.
let meetingDate = CalendarDateTime(year: 2020, month: 4, day: 1, hour: 10, minute: 30)
let meetingTimezone = TimeZone(identifier: "America/New_York")
let date = meetingDate.asDate(timezone: meetingTimezone!)
let formatter = DateFormatter()
formatter.dateStyle = .long
formatter.timeStyle = .long
formatter.timeZone = TimeZone(identifier: "America/New_York") // Or .current
formatter.string(from: date) // -> "April 1, 2020 at 10:30:00 AM EDT"Codable
The value types provided by this library all conform to Codable.
| Value Type | Codable format | |--- |--- | | CalendarTime | hh:mm:ss | | CalendarDate | YYYY-MM-DD | | CalendarDateTime | YYYY-MM-DDThh:mm:ss |
Recommended reads
Package Metadata
Repository: raymondjavaxx/calendardate
Default branch: master
README: README.md