{"id":28430944,"url":"https://github.com/elixir-cldr/cldr_calendars_composite","last_synced_at":"2025-07-04T17:30:57.504Z","repository":{"id":43310283,"uuid":"273672086","full_name":"elixir-cldr/cldr_calendars_composite","owner":"elixir-cldr","description":"Composite calendars (combining different non-overlapping calendars) based upon cldr_calendars","archived":false,"fork":false,"pushed_at":"2025-03-19T01:10:55.000Z","size":177,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-05T14:39:37.695Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/elixir-cldr.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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":"2020-06-20T08:51:22.000Z","updated_at":"2025-03-19T01:10:49.000Z","dependencies_parsed_at":"2025-03-19T12:00:57.612Z","dependency_job_id":null,"html_url":"https://github.com/elixir-cldr/cldr_calendars_composite","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/elixir-cldr/cldr_calendars_composite","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_calendars_composite","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_calendars_composite/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_calendars_composite/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_calendars_composite/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elixir-cldr","download_url":"https://codeload.github.com/elixir-cldr/cldr_calendars_composite/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_calendars_composite/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263587922,"owners_count":23484831,"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":[],"created_at":"2025-06-05T14:30:34.155Z","updated_at":"2025-07-04T17:30:57.499Z","avatar_url":"https://github.com/elixir-cldr.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cldr Composite Calendars\n\nMost calendar implementations in computer software implement the [Proleptic Gregorian Calendar](https://en.wikipedia.org/wiki/Proleptic_Gregorian_calendar) which projects the [Gregorian Calendar](https://en.wikipedia.org/wiki/Gregorian_calendar) backwards before its introduction starting in 1582.  In general use today this is acceptable since it is not common to be working with dates prior to this period.\n\nHowever for certain fields of study, the proleptic calendar is misleading. A letter or document dated in 1751 in England would be a date in the [Julian Calendar](https://en.wikipedia.org/wiki/Julian_calendar) since the Gregorian calendar wasn't introduced in England and its colonies until September 14th, 1752. This results in dates being 11 days later in the Gregorian calendar at this time compared with the Julian calendar.\n\nCalendars defined with this library support composing multiple calendars that are implemented for different time periods. While multiple calendars can be composed, the primary use case is to compose calendars that represent a continuum from the Julian calendar to the Gregorian calendar.\n\nCalendars defined with this library implement the `Calendar` behaviour and the `Cldr.Calendar` behaviour defined in the library [ex_cldr_calendars](https://hex.pm/packages/ex_cldr_calendars). See `Cldr.Calendar` for further information.\n\n## Defining a Composite Calendar\n\nA composite calendar is definted as a series of compositions reprenting the transition from one calendar to another. For the example of the transition from Julian to Gregorian calendar in England the first date of the Gregorian calendar is September 14th, 1752.\n\n```elixir\ndefmodule England do\n  use Cldr.Calendar.Composite,\n    calendars: ~D[1752-09-14],\n    base_calendar: Cldr.Calendar.Julian\nend\n```\n\nThis configuration states that September 14th, 1752 is the first day in the Gregorian calendar. The `:base_calendar` defines the calendar in use before any other composed calendar.  Since `Cldr.Calendar.Julian` is the default `:base_calendar`, this option may be omitted resulting in the following configuration:\n\n```elixir\ndefmodule England do\n  use Cldr.Calendar.Composite,\n    calendars: ~D[1752-09-14]\nend\n```\n\nIt is also possible to define new composite calendars at runtime as well:\n```elixir\niex\u003e Cldr.Calendar.Composite.new France, calendars: ~D[1582-12-20]\n{:ok, France}\n```\n\nA more complex example composes more than one calendar. For example, Egypt used the [Coptic calendar](https://en.wikipedia.org/wiki/Coptic_calendar) from 238 BCE until Rome introduced the Julian calendar in approximately 30 BCE. The Gregorian calendar was then introduced in 1875. Although the exact dates of introduction aren't known we can approximate the composition of calendars with:\n\n```elixir\ndefmodule Cldr.Calendar.Composite.Egypt do\n  use Cldr.Calendar.Composite,\n    calendars: [\n      ~D[-0045-01-01 Cldr.Calendar.Julian],\n      ~D[1875-09-01]\n    ],\n    base_calendar: Cldr.Calendar.Coptic\nend\n```\n\n## Installation\n\nAdd `ex_cldr_calendars_composite` to your list of dependencies in `mix.exs`.\n\n```elixir\ndef deps do\n  [\n    {:ex_cldr_calendars_composite, \"~\u003e 1.0\"}\n  ]\nend\n```\n\nDocumentation is published at [https://hexdocs.pm/ex_cldr_calendars_composite](https://hexdocs.pm/ex_cldr_calendars_composite).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-cldr%2Fcldr_calendars_composite","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felixir-cldr%2Fcldr_calendars_composite","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-cldr%2Fcldr_calendars_composite/lists"}