{"id":20970261,"url":"https://github.com/sbooth/juliandaynumber","last_synced_at":"2025-05-14T11:33:08.568Z","repository":{"id":204186351,"uuid":"711285681","full_name":"sbooth/JulianDayNumber","owner":"sbooth","description":"Julian date calculations and calendar conversions for Swift","archived":false,"fork":false,"pushed_at":"2024-10-15T15:26:35.000Z","size":378,"stargazers_count":3,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-17T17:36:46.015Z","etag":null,"topics":["calendars","gregorian-calendar","julian-calendar","julian-date","julian-day-number","swift"],"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/sbooth.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-28T19:12:16.000Z","updated_at":"2024-10-24T12:55:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"81f27d4a-b36a-404a-a8b4-c03ea64a24f9","html_url":"https://github.com/sbooth/JulianDayNumber","commit_stats":null,"previous_names":["sbooth/juliandaynumber"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbooth%2FJulianDayNumber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbooth%2FJulianDayNumber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbooth%2FJulianDayNumber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbooth%2FJulianDayNumber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbooth","download_url":"https://codeload.github.com/sbooth/JulianDayNumber/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225292100,"owners_count":17451086,"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":["calendars","gregorian-calendar","julian-calendar","julian-date","julian-day-number","swift"],"created_at":"2024-11-19T03:57:26.831Z","updated_at":"2024-11-19T03:57:28.010Z","avatar_url":"https://github.com/sbooth.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JulianDayNumber\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fsbooth%2FJulianDayNumber%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/sbooth/JulianDayNumber)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fsbooth%2FJulianDayNumber%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/sbooth/JulianDayNumber)\n\nJulian day number and Julian date calculations supporting the following calendars:\n\n| Calendar | Epoch ¹ | Era |\n| --- | --- | --- |\n| [Armenian](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/armeniancalendar) | 0552-07-11 CE | Armenian |\n| [Astronomical](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/astronomicalcalendar) | 0001-01-01 CE | CE |\n| [Baháʼí](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/bahaicalendar) | 1844-03-21 CE | Baháʼí |\n| [Coptic](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/copticcalendar) | 0284-08-29 CE | Diocletian |\n| [Egyptian](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/egyptiancalendar) | 0747-02-26 BCE | Nabonassar |\n| [Ethiopian](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/ethiopiancalendar) | 0008-08-29 CE | Incarnation |\n| [French Republican](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/frenchrepublicancalendar) | 1792-09-22 CE | Republican |\n| [Gregorian](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/gregoriancalendar) | 0001-01-01 CE | CE |\n| [Hebrew](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/hebrewcalendar) | 3761-10-07 BCE | AM |\n| [Islamic](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/islamiccalendar) | 0622-07-16 CE | AH |\n| [ISO](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/isocalendar) | |\n| [Julian](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/juliancalendar) | 0001-01-01 CE | CE |\n| [Khwarizmian](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/khwarizmiancalendar) | 0632-06-21 CE | Yazdegerd |\n| [Macedonian](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/macedoniancalendar) | 0312-09-01 BCE | Alexander |\n| [Maya](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/mayacalendar) | 3114-09-06 BCE | |\n| [Persian](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/persiancalendar) | 0632-06-16 CE | Yazdegerd |\n| [Śaka](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/sakacalendar) | 0079-03-24 CE | Śaka |\n| [Syrian](https://swiftpackageindex.com/sbooth/juliandaynumber/main/documentation/juliandaynumber/syriancalendar) | 0312-10-01 BCE | Alexander |\n\n¹ Epoch in Julian calendar\n\nThe Julian day number interconverting algorithms use integer math to avoid rounding errors and the implementations have been round-trip tested for all valid Julian day numbers in the years -999,999 to +999,999.\n\n## Installation\n\n### Swift Package Manager\n\nAdd a package dependency to https://github.com/sbooth/JulianDayNumber in Xcode.\n\n### Manual or Custom Build\n\n1. Clone the [JulianDayNumber](https://github.com/sbooth/JulianDayNumber) repository.\n2. `swift build`.\n\n## Examples\n\n1. Calculate the Julian date for the total solar eclipse on 1919-05-29.\n\n```swift\nlet jd = AstronomicalCalendar.julianDateFrom(year: 1919, month: 5, day: 29)\n// 2422107.5\n```\n\n\u003e [!NOTE]\n\u003e The astronomical calendar is a hybrid calendar using the Julian calendar for dates before October 15, 1582 and the Gregorian calendar for later dates.\n\n2. Convert the Julian date 2422107.5 to a `Date` instance.\n\n```swift\nlet d = Date(julianDate: 2422107.5)\n// Foundation.Date\t1919-05-29 00:00:00 UTC\n```\n\n3. Convert the Gregorian calendar date 2013-10-31 to a date in the Julian calendar.\n\n```swift\nlet j = GregorianCalendar.julianDayNumberFrom(year: 2013, month: 10, day: 31)\nlet julianYMD = JulianCalendar.dateFromJulianDayNumber(j)\n// (year: 2013, month: 10, day: 18)\n```\n\n## Documentation\n\nThe [latest documentation](https://swiftpackageindex.com/sbooth/JulianDayNumber/main/documentation/juliandaynumber) is hosted by [Swift Package Index](https://swiftpackageindex.com).\n\nAll public classes, structs, and functions should be documented. If you notice a documentation shortcoming please [open a new issue](https://github.com/sbooth/JulianDayNumber/issues/new/choose).\n\n## Limits\n\nThe following table summarizes the arithmetic limits for Julian day number calculations.\n\n| Calendar | Minimum JDN | Maximum JDN |\n| --- | --- | --- |\n| Armenian | `Int.min` + 341 | `Int.max` - 317 |\n| Baháʼí | `Int.min` + 56457 | 2305795661307959248 |\n| Coptic | `Int.min` + 384 | (`Int.max` - 3) / 4 - 124 |\n| Egyptian | `Int.min` + 611 | `Int.max` - 47 |\n| Ethiopian | `Int.min` + 384 | (`Int.max` - 3) / 4 - 124 |\n| French Republican | `Int.min` + 56759 | 2305795661307960548 |\n| Gregorian | `Int.min` + 56457 | 2305795661307959247 |\n| Hebrew | `Int.min` + 106960181 | 355839970905570 |\n| Islamic | `Int.min` + 325 | (`Int.max` - 15) / 30 - 7664 |\n| Julian | `Int.min` + 144 | (`Int.max` - 3) / 4 - 1401 |\n| Khwarizmian | `Int.min` + 341 | `Int.max` - 317 |\n| Macedonian | `Int.min` + 144 | (`Int.max` - 3) / 4 - 1401 |\n| Maya Long Count | `Int.min` + 584291 | `Int.max` |\n| Persian | `Int.min` + 336 | `Int.max` - 77 |\n| Śaka | `Int.min` + 56457 | 2305795661307959298 |\n| Syrian | `Int.min` + 144 | (`Int.max` - 3) / 4 - 1401 |\n\n## License\n\nJulianDayNumber is released under the [MIT License](https://github.com/sbooth/JulianDayNumber/blob/main/LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbooth%2Fjuliandaynumber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbooth%2Fjuliandaynumber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbooth%2Fjuliandaynumber/lists"}