{"id":28430964,"url":"https://github.com/elixir-cldr/cldr_calendars_format","last_synced_at":"2026-05-26T13:34:15.740Z","repository":{"id":57499636,"uuid":"182176591","full_name":"elixir-cldr/cldr_calendars_format","owner":"elixir-cldr","description":"HTML formatted localised week and month based calendars","archived":false,"fork":false,"pushed_at":"2025-12-16T08:14:44.000Z","size":93,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-27T19:51:40.988Z","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,"zenodo":null}},"created_at":"2019-04-19T00:43:16.000Z","updated_at":"2025-12-15T21:43:34.000Z","dependencies_parsed_at":"2025-07-04T17:37:36.792Z","dependency_job_id":"dec27421-f657-49ca-abfc-0d4019b872e3","html_url":"https://github.com/elixir-cldr/cldr_calendars_format","commit_stats":null,"previous_names":["kipcole9/cldr_calendars_format"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/elixir-cldr/cldr_calendars_format","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_calendars_format","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_calendars_format/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_calendars_format/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_calendars_format/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elixir-cldr","download_url":"https://codeload.github.com/elixir-cldr/cldr_calendars_format/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_calendars_format/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30150403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T21:15:50.531Z","status":"ssl_error","status_checked_at":"2026-03-05T21:15:11.173Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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:41.209Z","updated_at":"2026-03-05T21:31:23.621Z","avatar_url":"https://github.com/elixir-cldr.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cldr Calendar Formatting\n\n[ex_cldr_calendars_format](https://hex.pm/packages/ex_cldr_calendars_format) provides a framework for formatting [calendars](https://hex.pm/packages/ex_cldr_calendars) for output.  It includes example formatters for HTML (`Cldr.Calendar.Formatter.HTML.Basic`), HTML for week-based calendars (`Cldr.Calendar.Formatter.HTML.Week`) and Markdown (`Cldr.Calendar.Formatter.Markdown`).\nThese examples may be used as-is but supporting the development of formatters that meet specific requirements is a design objective which is implemented via the `Cldr.Calendar.Formatter` behaviour.\n\n## Getting Started\n\nA formatted calendar is generated via `Cldr.Calendar.Format.year/2` or `Cldr.Calendar.Format.month/3`.  For example, to generate a simple HTML calendar for April 2019:\n\n```elixir\niex\u003e Cldr.Calendar.Format.month 2019, 4\n\"\u003ctable class=\\\"cldr_calendar\\\"\u003e\\n  \u003ccaption\u003eApril 2019\u003c/caption\\n  \u003cth\u003e\\n    \u003ctd class=\\\"day_name, weekday\\\"\u003eMon\u003c/td\u003e\\n    \u003ctd class=\\\"day_name, weekday\\\"\u003eTue\u003c/td\u003e\\n    \u003ctd class=\\\"day_name, weekday\\\"\u003eWed\u003c/td\u003e\\n....\"\n```\n\nFrom this example we can deduce that:\n\n* The default calendar is `Cldr.Calendar.Gregorian` which is compatible with the standard `Calendar.ISO` but includes additional functionality to support the notion of weeks.\n\n* That the default calendar has a week that starts on Monday (not all calendars start the week on Monday)\n\n* That the default locale is \"en\" (English).  Calendars can be localised to any locale supported by [ex_cldr](https://hex.pm/packages/ex_cldr)\n\n* That the default formatter is `Cldr.Calendar.Formatter.HTML.Basic`. Any formatter can be invoked and additional formatters `Cldr.Calendar.Formatter.HTML.Week` and `Cldr.Calendar.Formatter.Markdown` are included.\n\n### Formatting a week-based calendar\n\nWeek-based calendars, like [ISO Week](https://en.wikipedia.org/wiki/ISO_week_date) and [National Retail Federation](https://nrf.com/resources/4-5-4-calendar), don't have months in the traditional sense however they can be formatted in a month-like fashion.  The formatter `Cldr.Calendar.Formatter.HTML.Week` is different from `Cldr.Calendar.Formatter.HTML.Basic` in that is includes the week number as well as the dates.  It also converts each date into the `Cldr.Calendar.Gregorian` calendar for familiar formatting.  For example:\n\n```elixir\niex\u003e Cldr.Calendar.Format.month 2019, 4, calendar: Cldr.Calendar.NRF, formatter: Cldr.Calendar.Formatter.HTML.Week\n\"\u003ctable class=\\\"cldr_calendar\\\"\u003e\\n  \u003ccaption\u003eApril 2019\u003c/caption\\n  \u003cth\u003e\\n    \u003ctd\u003e \u003c/td\u003e\\n    \u003ctd class=\\\"day_name, weekend\\\"\u003eSun\u003c/td\u003e\\n    \u003ctd class=\\\"day_name, weekday\\\"\u003eMon\u003c/td\u003e\\n    \u003ctd class=\\\"day_name, weekday\\\"\u003eTue\u003c/td\u003e\\n    \u003ctd class=\\\"day_name, weekday\\\"\u003eWed\u003c/td\u003e\\n    \u003ctd class=\\\"day_name, weekday\\\"\u003eThu\u003c/td\u003e\\n    \u003ctd class=\\\"day_name, weekday\\\"\u003eFri\u003c/td\u003e\\n    \u003ctd class=\\\"day_name, weekend\\\"\u003eSat\u003c/td\u003e\\n\\n  \u003c/th\u003e\\n  \u003ctr\u003e\\n    \u003ctd class=\\\"week\\\"\u003eW14\u003c/td\u003e\\n ... \"\n```\n\nThis example shows that the first day of the week for the `Cldr.Calendar.NRF` calendar is Sunday and that the week number is included.\n\n### Formatting Markdown\n\nThe `Cldr.Calendar.Formatter.Markdown` formatter is a simple formatter.  Using the simple example for April 2019 the example shows:\n```elixir\niex\u003e Cldr.Calendar.Format.month 2019, 4, formatter: Cldr.Calendar.Formatter.Markdown\n\"### April 2019\\n\\nMon | Tue | Wed | Thu | Fri | Sat | Sun\\n :---:  |  :---:  |  :---:  |  :---:  |  :---:  |  :---:  |  :---: \\n**1** | **2** | **3** | **4** | **5** | **6** | **7**\\n**8** | **9** | **10** | **11** | **12** | **13** | **14**\\n**15** | **16** | **17** | **18** | **19** | **20** | **21**\\n**22** | **23** | **24** | **25** | **26** | **27** | **28**\\n**29** | **30** | 1 | 2 | 3 | 4 | 5\\n6 | 7 | 8 | 9 | 10 | 11 | 12\\n\"\n```\nWhich renders as (heading omitted):\n\nMon | Tue | Wed | Thu | Fri | Sat | Sun\n :---:  |  :---:  |  :---:  |  :---:  |  :---:  |  :---:  |  :---:\n**1** | **2** | **3** | **4** | **5** | **6** | **7**\n**8** | **9** | **10** | **11** | **12** | **13** | **14**\n**15** | **16** | **17** | **18** | **19** | **20** | **21**\n**22** | **23** | **24** | **25** | **26** | **27** | **28**\n**29** | **30** | 1 | 2 | 3 | 4 | 5\n6 | 7 | 8 | 9 | 10 | 11 | 12\n\n### Calendar localization\n\nSince [ex_cldr_calendars_format](https://hex.pm/packages/ex_cldr_calendars_format) is built upon [ex_cldr](https://hex.pm/packages/ex_cldr), calendars can be localised.  Localised formatting understands the weekend and weekdays for a given locale or territory and can use the default of native number system (which may use localised characters for numbers).  For example, using the locale for Saudi Arabia we can see:\n\n```elixir\niex\u003e markdown = Cldr.Calendar.Format.month 2019, 4, formatter: Cldr.Calendar.Formatter.Markdown, locale: \"ar-SA\"\n\"### أبريل ٢٠١٩\\n\\nالاثنين | الثلاثاء | الأربعاء | الخميس | الجمعة | السبت | الأحد\\n :---:  |  :---:  |  :---:  |  :---:  |  :---:  |  :---:  |  :---: \\n**١** | **٢** | **٣** | **٤** | **٥** | **٦** | **٧**\\n**٨** | **٩** | **١٠** | **١١** | **١٢** | **١٣** | **١٤**\\n**١٥** | **١٦** | **١٧** | **١٨** | **١٩** | **٢٠** | **٢١**\\n**٢٢** | **٢٣** | **٢٤** | **٢٥** | **٢٦** | **٢٧** | **٢٨**\\n**٢٩** | **٣٠** | ١ | ٢ | ٣ | ٤ | ٥\\n٦ | ٧ | ٨ | ٩ | ١٠ | ١١ | ١٢\\n\"\n```\nWhich renders as (heading omitted):\n\nالاثنين | الثلاثاء | الأربعاء | الخميس | الجمعة | السبت | الأحد\n :---:  |  :---:  |  :---:  |  :---:  |  :---:  |  :---:  |  :---:\n**١** | **٢** | **٣** | **٤** | **٥** | **٦** | **٧**\n**٨** | **٩** | **١٠** | **١١** | **١٢** | **١٣** | **١٤**\n**١٥** | **١٦** | **١٧** | **١٨** | **١٩** | **٢٠** | **٢١**\n**٢٢** | **٢٣** | **٢٤** | **٢٥** | **٢٦** | **٢٧** | **٢٨**\n**٢٩** | **٣٠** | ١ | ٢ | ٣ | ٤ | ٥\n٦ | ٧ | ٨ | ٩ | ١٠ | ١١ | ١٢\n\n### Configuring a Cldr backend for localization\n\nIn order to localize date parts a`backend` module must be defined. This\nis a module which hosts the CLDR data for a set of locales. The detailed\ninformation for configuring a `backend` is [documented here](https://hexdocs.pm/ex_cldr/readme.html#configuration).\n\nFor a simple configuration the following steps may be used:\n\n1. Create a backend module.\n\nNote that the provider `Cldr.Number` must be configured since it supports localisation of number formatting.\n\n```\ndefmodule MyApp.Cldr do\n  use Cldr,\n    locales: [\"en\", \"fr\", \"jp\", \"ar\"],\n    providers: [Cldr.Number]\n\nend\n```\n\n2. Optionally configure this backend as the system default in your `config.exs`.\n```\nconfig :ex_cldr,\n  default_backend: MyApp.Cldr\n```\n\n## Installation\n\nThis package can be installed by adding `ex_cldr_calendars_format` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    ...\n    {:ex_cldr_calendars_format, \"~\u003e 1.0\"}\n  ]\nend\n```\n\nDocumentation can be found at [https://hexdocs.pm/ex_cldr_calendars_format](https://hexdocs.pm/ex_cldr_calendars_format).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-cldr%2Fcldr_calendars_format","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felixir-cldr%2Fcldr_calendars_format","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-cldr%2Fcldr_calendars_format/lists"}