{"id":26483682,"url":"https://github.com/raymondjavaxx/calendardate","last_synced_at":"2026-03-06T18:41:53.247Z","repository":{"id":56905599,"uuid":"219262777","full_name":"raymondjavaxx/CalendarDate","owner":"raymondjavaxx","description":"Naive date and time for Swift","archived":false,"fork":false,"pushed_at":"2023-01-17T21:18:44.000Z","size":25,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-14T11:14:34.740Z","etag":null,"topics":["date","date-time","swift","time","timezone"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/raymondjavaxx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-03T06:50:30.000Z","updated_at":"2023-10-30T00:29:23.000Z","dependencies_parsed_at":"2023-02-10T12:00:24.101Z","dependency_job_id":null,"html_url":"https://github.com/raymondjavaxx/CalendarDate","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondjavaxx%2FCalendarDate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondjavaxx%2FCalendarDate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondjavaxx%2FCalendarDate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raymondjavaxx%2FCalendarDate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raymondjavaxx","download_url":"https://codeload.github.com/raymondjavaxx/CalendarDate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244554074,"owners_count":20471173,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["date","date-time","swift","time","timezone"],"created_at":"2025-03-20T04:57:38.724Z","updated_at":"2026-03-06T18:41:53.197Z","avatar_url":"https://github.com/raymondjavaxx.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build](https://github.com/raymondjavaxx/CalendarDate/workflows/Build/badge.svg)](https://github.com/raymondjavaxx/CalendarDate/actions)\n\n# CalendarDate\n\nCalendar 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 with future events](http://www.creativedeletion.com/2015/03/19/persisting_future_datetimes.html), as in the case of event and appointment scheduling apps.\n\nCalendarDate provides the following value types:\n\n* `CalendarTime`: Represents a wall time, such as \"2:00PM\".\n* `CalendarDate`: Represents a calendar date, such as a birthday.\n* `CalendarDateTime`: Groups `CalendarDate` and `CalendarTime` to represent a date + time.\n\n## How to use it\n\nYou can initialize a `CalendarDateTime` value directly and convert it to a Swift `Date` when you need to display it to the user.\n\n\n```swift\nlet meetingDate = CalendarDateTime(year: 2020, month: 4, day: 1, hour: 10, minute: 30)\nlet meetingTimezone = TimeZone(identifier: \"America/New_York\")\n\nlet date = meetingDate.asDate(timezone: meetingTimezone!)\n\nlet formatter = DateFormatter()\nformatter.dateStyle = .long\nformatter.timeStyle = .long\nformatter.timeZone = TimeZone(identifier: \"America/New_York\") // Or .current\n\nformatter.string(from: date) // -\u003e \"April 1, 2020 at 10:30:00 AM EDT\"\n```\n\n### Codable\n\nThe value types provided by this library all conform to [Codable](https://developer.apple.com/documentation/swift/codable).\n\n| Value Type   | Codable format |\n|---  |---  |\n| `CalendarTime` | hh:mm:ss |\n| `CalendarDate` | YYYY-MM-DD |\n| `CalendarDateTime` | YYYY-MM-DDThh:mm:ss |\n\n\n## Recommended reads\n\n* [How to save datetimes for future events - (when UTC is not the right answer.)](http://www.creativedeletion.com/2015/03/19/persisting_future_datetimes.html)\n* [Falsehoods programmers believe about time and time zones.](http://www.creativedeletion.com/2015/01/28/falsehoods-programmers-date-time-zones.html)\n* [Time Zones Aren't Offsets – Offsets Aren't Time Zones.](https://spin.atomicobject.com/2016/07/06/time-zones-offsets/)\n* [Working with Time Zones.](https://www.w3.org/TR/timezone/#history)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraymondjavaxx%2Fcalendardate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraymondjavaxx%2Fcalendardate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraymondjavaxx%2Fcalendardate/lists"}