{"id":28430984,"url":"https://github.com/elixir-cldr/cldr_dates_times","last_synced_at":"2026-01-17T00:28:38.319Z","repository":{"id":24726557,"uuid":"100650132","full_name":"elixir-cldr/cldr_dates_times","owner":"elixir-cldr","description":"Date \u0026 times formatting functions for the Common Locale Data Repository (CLDR) package https://github.com/elixir-cldr/cldr","archived":false,"fork":false,"pushed_at":"2026-01-04T07:37:36.000Z","size":1244,"stargazers_count":72,"open_issues_count":2,"forks_count":14,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-01-08T10:47:05.916Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2017-08-17T22:29:04.000Z","updated_at":"2026-01-04T07:37:40.000Z","dependencies_parsed_at":"2023-10-14T17:39:17.894Z","dependency_job_id":"26b605c5-3997-467a-94ac-79a53346b1ff","html_url":"https://github.com/elixir-cldr/cldr_dates_times","commit_stats":{"total_commits":279,"total_committers":8,"mean_commits":34.875,"dds":0.06093189964157708,"last_synced_commit":"f5a7016b6d47db0bb9ca320125d9a9ddc91f01ae"},"previous_names":[],"tags_count":88,"template":false,"template_full_name":null,"purl":"pkg:github/elixir-cldr/cldr_dates_times","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_dates_times","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_dates_times/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_dates_times/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_dates_times/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elixir-cldr","download_url":"https://codeload.github.com/elixir-cldr/cldr_dates_times/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elixir-cldr%2Fcldr_dates_times/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28490097,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T23:55:29.509Z","status":"ssl_error","status_checked_at":"2026-01-16T23:55:29.108Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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:43.735Z","updated_at":"2026-01-17T00:28:38.272Z","avatar_url":"https://github.com/elixir-cldr.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Date and Time Localization and Formatting\n\n![Build status](https://github.com/elixir-cldr/cldr_dates_times/actions/workflows/ci.yml/badge.svg)\n[![Hex.pm](https://img.shields.io/hexpm/v/ex_cldr_dates_times.svg)](https://hex.pm/packages/ex_cldr_dates_times)\n[![Hex.pm](https://img.shields.io/hexpm/dw/ex_cldr_dates_times.svg?)](https://hex.pm/packages/ex_cldr_dates_times)\n[![Hex.pm](https://img.shields.io/hexpm/dt/ex_cldr_dates_times.svg?)](https://hex.pm/packages/ex_cldr_dates_times)\n[![Hex.pm](https://img.shields.io/hexpm/l/ex_cldr_dates_times.svg)](https://hex.pm/packages/ex_cldr_dates_times)\n\n## Installation\n\n**Note that `ex_cldr_dates_times` requires Elixir 1.12 or later.**\n\nAdd `ex_cldr_dates_time` as a dependency to your `mix` project:\n\n```\ndefp deps do\n  [\n    {:ex_cldr_dates_times, \"~\u003e 2.0\"}\n  ]\nend\n```\n\nthen retrieve `ex_cldr_dates_times` from [hex](https://hex.pm/packages/ex_cldr_dates_times):\n\n```\nmix deps.get\nmix deps.compile\n```\n\n### Configuring a required backend module\n\n`ex_cldr_dates_times` uses the configuration set for the dependency `ex_cldr`.  See the documentation for [ex_cldr](https://hexdocs.pm/ex_cldr/2.0.0/readme.html#configuration).\n\nA `backend` module is required that is used to host the functions that manage CLDR data.  An example to get started is:\n\n1. Create a backend module (see [ex_cldr](https://hexdocs.pm/ex_cldr/2.0.0/readme.html#configuration) for details of the available options). Note the requirement to configure the appropriate `Cldr` provider backends.\n\n    ```elixir\n    defmodule MyApp.Cldr do\n      use Cldr,\n        locales: [\"en\", \"fr\", \"ja\"],\n        providers: [Cldr.Number, Cldr.Calendar, Cldr.DateTime]\n\n    end\n    ```\n\n2. [Optional] Update `config.exs` configuration to specify this backend as the system default. Not required, but often useful.\n\n    ```elixir\n    config :ex_cldr,\n      default_locale: \"en\",\n      default_backend: MyApp.Cldr\n    ```\n\n## Introduction\n\n`ex_cldr_dates_times` is an addon library application for [ex_cldr](https://hex.pm/packages/ex_cldr) that provides localisation and formatting for dates, times and date_times.\n\nThe primary API is `MyApp.Cldr.Date.to_string/2`, `MyApp.Cldr.Time.to_string/2`, `MyApp.Cldr.DateTime.to_string/2` and `MyApp.Cldr.DateTime.Relative.to_string/2`.  In the following examples `MyApp` refers to a CLDR backend module that must be defined by the developer:\n\n```elixir\niex\u003e MyApp.Cldr.Date.to_string ~D[2020-05-30]\n{:ok, \"May 30, 2020\"}\n\niex\u003e MyApp.Cldr.Time.to_string ~U[2020-05-30 03:52:56Z]\n{:ok, \"3:52:56 AM\"}\n\niex\u003e MyApp.Cldr.DateTime.to_string ~U[2020-05-30 03:52:56Z]\n{:ok, \"May 30, 2020, 3:52:56 AM\"}\n\n# Note that if options are provided, a backend\n# module is also required\niex\u003e MyApp.Cldr.DateTime.Relative.to_string 1, unit: :day, format: :narrow\n{:ok, \"tomorrow\"}\n```\n\nFor help in `iex`:\n\n```elixir\niex\u003e h MyApp.Cldr.Date.to_string\niex\u003e h MyApp.Cldr.Time.to_string\niex\u003e h MyApp.Cldr.DateTime.to_string\niex\u003e h MyApp.Cldr.DateTime.Relative.to_string\n```\n\n## Date, Time and DateTime Localization Formats\n\nDates, Times and DateTimes can be formatted using standard formats, format strings or format IDs.\n\n* Standard formats provide cross-locale standardisation and therefore should be preferred where possible.  The format types, implemented for `MyApp.Cldr.Date.to_string/2`, `MyApp.Cldr.Time.to_string/2`,`MyApp.Cldr.DateTime.to_string/2` are `:short`, `:medium`, `:long`  and `:full`.   The default is `:medium`. For example, assuming a configured backend called `MyApp.Cldr`:\n\n    ```elixir\n    iex\u003e MyApp.Cldr.DateTime.to_string ~U[2020-05-30 03:52:56Z], format: :short\n    {:ok, \"5/30/20, 3:52 AM\"}\n\n    iex\u003e MyApp.Cldr.DateTime.to_string ~U[2020-05-30 03:52:56Z], format: :long\n    {:ok, \"May 30, 2020 at 3:52:56 AM UTC\"}\n\n    iex\u003e MyApp.Cldr.DateTime.to_string ~U[2020-05-30 03:52:56Z], format: :medium\n    {:ok, \"May 30, 2020, 3:52:56 AM\"}\n\n    iex\u003e MyApp.Cldr.DateTime.to_string ~U[2020-05-30 03:52:56Z], format: :long, locale: \"fr\"\n    {:ok, \"30 mai 2020 à 03:52:56 UTC\"}\n    ```\n\n* Format strings use one or more formatting symbols to define what date and time elements should be placed in the format.  A simple example to format the time into hours and minutes:\n\n    ```elixir\n    iex\u003e MyApp.Cldr.DateTime.to_string ~U[2020-05-30 03:52:56Z], format: \"hh:mm\"\n    {:ok, \"03:52\"}\n    ```\n\n* Format IDs are an atom that is a key into a map of formats defined by CLDR. These format IDs are returned by `MyApp.Cldr.DateTime.Format.date_time_available_formats/2` (assuming your backend is `MyApp.Cldr`).  The set of common format names across all locales configured in `ex_cldr` can be returned by `MyApp.Cldr.DateTime.Format.common_date_time_format_names/0`.\n\n    ```elixir\n    iex\u003e MyApp.Cldr.DateTime.Format.date_time_available_formats()\n    %{mmmm_w_count_one: \"'week' W 'of' MMMM\", gy_mmm: \"MMM y G\", md: \"M/d\",\n    mmm_md: \"MMMM d\", e_hms: \"E HH:mm:ss\", ed: \"d E\", y_mmm: \"MMM y\",\n    e_hm: \"E HH:mm\", mmm_ed: \"E, MMM d\", y_mmm_ed: \"E, MMM d, y\",\n    gy_mm_md: \"MMM d, y G\", mmm: \"LLL\", y_md: \"M/d/y\", gy: \"y G\",\n    hms: \"h:mm:ss a\", hm: \"h:mm a\", y_mmmm: \"MMMM y\", m: \"L\",\n    gy_mmm_ed: \"E, MMM d, y G\", y_qqq: \"QQQ y\", e: \"ccc\", y_qqqq: \"QQQQ y\",\n    hmsv: \"h:mm:ss a v\", mmmm_w_count_other: \"'week' W 'of' MMMM\",\n    ehm: \"E h:mm a\", y_m_ed: \"E, M/d/y\", h: \"h a\", hmv: \"h:mm a v\",\n    yw_count_other: \"'week' w 'of' y\", mm_md: \"MMM d\", y_m: \"M/y\", m_ed: \"E, M/d\",\n    ms: \"mm:ss\", d: \"d\", y_mm_md: \"MMM d, y\", yw_count_one: \"'week' w 'of' y\",\n    y: \"y\", ehms: \"E h:mm:ss a\"}\n\n    # These format types can be invoked for any locale - meaning\n    # these format names are defined for all configured locales.\n    iex\u003e MyApp.Cldr.DateTime.Format.common_date_time_format_names()\n    [:gy_mmm, :md, :mmm_md, :e_hms, :ed, :y_mmm, :e_hm, :mmm_ed, :y_mmm_ed,\n    :gy_mm_md, :mmm, :y_md, :gy, :hms, :hm, :y_mmmm, :m, :gy_mmm_ed, :y_qqq, :e,\n    :y_qqqq, :hmsv, :mmmm_w_count_other, :ehm, :y_m_ed, :h, :hmv, :yw_count_other,\n    :mm_md, :y_m, :m_ed, :ms, :d, :y_mm_md, :y, :ehms]\n\n    iex\u003e Cldr.DateTime.to_string ~U[2020-05-30 03:52:56Z], MyApp.Cldr, format: :gy_mmm_ed\n    {:ok, \"Sat, May 30, 2020 AD\"}\n\n    iex(2)\u003e Cldr.Time.to_string ~U[2020-05-30 03:52:56Z], MyApp.Cldr, format: :hm\n    {:ok, \"3:52 AM\"}\n\n    iex(3)\u003e Cldr.Date.to_string ~U[2020-05-30 03:52:56Z], MyApp.Cldr, format: :yMd\n    {:ok, \"5/30/2020\"}\n    ```\n\n## Format strings\n\nThe [CLDR standard](http://unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table)\ndefines a wide range of format symbols.  Most - but not all - of these symbols are supported in\n`Cldr`.  The supported symbols are described below.  Note the [known restrictions and limitations](#known-restrictions-and-limitations).\n\n| Element                | Symbol     | Example         | Cldr Format                        |\n| :--------------------  | :--------  | :-------------- | :--------------------------------- |\n| Era                    | G, GG, GGG | \"AD\"            | Abbreviated                        |\n|                        | GGGG       | \"Anno Domini\"   | Wide                               |\n|                        | GGGGG      | \"A\"             | Narrow                             |\n| Year                   | y          | 7               | Minimum necessary digits           |\n|                        | yy         | \"17\"            | Least significant 2 digits         |\n|                        | yyy        | \"017\", \"2017\"   | Padded to at least 3 digits        |\n|                        | yyyy       | \"2017\"          | Padded to at least 4 digits        |\n|                        | yyyyy      | \"02017\"         | Padded to at least 5 digits        |\n| ISOWeek Year           | Y          | 7               | Minimum necessary digits           |\n|                        | YY         | \"17\"            | Least significant 2 digits         |\n|                        | YYY        | \"017\", \"2017\"   | Padded to at least 3 digits        |\n|                        | YYYY       | \"2017\"          | Padded to at least 4 digits        |\n|                        | YYYYY      | \"02017\"         | Padded to at least 5 digits        |\n| Related Gregorian Year | r, rr, rr+ | 2017            | Minimum necessary digits           |\n| Cyclic Year            | U, UU, UUU | \"甲子\"           | Abbreviated                        |\n|                        | UUUU       | \"甲子\" (for now) | Wide                               |\n|                        | UUUUU      | \"甲子\" (for now) | Narrow                             |\n| Extended Year          | u+         | 4601            | Minimum necessary digits           |\n| Quarter                | Q          | 2               | Single digit                       |\n|                        | QQ         | \"02\"            | Two digits                         |\n|                        | QQQ        | \"Q2\"            | Abbreviated                        |\n|                        | QQQQ       | \"2nd quarter\"   | Wide                               |\n|                        | QQQQQ      | \"2\"             | Narrow                             |\n| Standalone Quarter     | q          | 2               | Single digit                       |\n|                        | qq         | \"02\"            | Two digits                         |\n|                        | qqq        | \"Q2\"            | Abbreviated                        |\n|                        | qqqq       | \"2nd quarter\"   | Wide                               |\n|                        | qqqqq      | \"2\"             | Narrow                             |\n| Month                  | M          | 9               | Single digit                       |\n|                        | MM         | \"09\"            | Two digits                         |\n|                        | MMM        | \"Sep\"           | Abbreviated                        |\n|                        | MMMM       | \"September\"     | Wide                               |\n|                        | MMMMM      | \"S\"             | Narrow                             |\n| Standalone Month       | L          | 9               | Single digit                       |\n|                        | LL         | \"09\"            | Two digits                         |\n|                        | LLL        | \"Sep\"           | Abbreviated                        |\n|                        | LLLL       | \"September\"     | Wide                               |\n|                        | LLLLL      | \"S\"             | Narrow                             |\n| Week of Year           | w          | 2, 22           | Single digit                       |\n|                        | ww         | 02, 22          | Two digits, zero padded            |\n| Week of Month          | W          | 2               | Single digit. NOT IMPLEMENTED YET  |\n| Day of Year            | D          | 3, 33, 333      | Minimum necessary digits           |\n|                        | DD         | 03, 33, 333     | Minimum of 2 digits, zero padded   |\n|                        | DDD        | 003, 033, 333   | Minimum of 3 digits, zero padded   |\n| Day of Month           | d          | 2, 22           | Minimum necessary digits           |\n|                        | dd         | 02, 22          | Two digits, zero padded            |\n| Day of Week            | E, EE, EEE | \"Tue\"           | Abbreviated                        |\n|                        | EEEE       | \"Tuesday\"       | Wide                               |\n|                        | EEEEE      | \"T\"             | Narrow                             |\n|                        | EEEEEE     | \"Tu\"            | Short                              |\n|                        | e          | 2               | Single digit                       |\n|                        | ee         | \"02\"            | Two digits                         |\n|                        | eee        | \"Tue\"           | Abbreviated                        |\n|                        | eeee       | \"Tuesday\"       | Wide                               |\n|                        | eeeee      | \"T\"             | Narrow                             |\n|                        | eeeeee     | \"Tu\"            | Short                              |\n| Standalone Day of Week | c, cc      | 2               | Single digit                       |\n|                        | ccc        | \"Tue\"           | Abbreviated                        |\n|                        | cccc       | \"Tuesday\"       | Wide                               |\n|                        | ccccc      | \"T\"             | Narrow                             |\n|                        | cccccc     | \"Tu\"            | Short                              |\n| AM or PM               | a, aa, aaa | \"am.\"           | Abbreviated                        |\n|                        | aaaa       | \"am.\"           | Wide                               |\n|                        | aaaaa      | \"am\"            | Narrow                             |\n| Noon, Mid, AM, PM      | b, bb, bbb | \"mid.\"          | Abbreviated                        |\n|                        | bbbb       | \"midnight\"      | Wide                               |\n|                        | bbbbb      | \"md\"            | Narrow                             |\n| Flexible time period   | B, BB, BBB | \"at night\"      | Abbreviated                        |\n|                        | BBBB       | \"at night\"      | Wide                               |\n|                        | BBBBB      | \"at night\"      | Narrow                             |\n| Hour                   | h, K, H, k |                 | See the table below                |\n| Minute                 | m          | 3, 10           | Minimum digits of minutes          |\n|                        | mm         | \"03\", \"12\"      | Two digits, zero padded            |\n| Second                 | s          | 3, 48           | Minimum digits of seconds          |\n|                        | ss         | \"03\", \"48\"      | Two digits, zero padded            |\n| Fractional Seconds     | S          | 3, 48           | Minimum digits of fractional seconds |\n|                        | SS         | \"03\", \"48\"      | Two digits, zero padded            |\n| Milliseconds            | A+         | 4000, 63241     | Minimum digits of milliseconds since midnight |\n| Generic non-location TZ | v         | \"Etc/UTC\"       | `:time_zone` key, unlocalised      |\n|                         | vvvv      | \"unk\"           | Generic timezone name.  Currently returns only \"unk\" |\n| Specific non-location TZ | z..zzz   | \"UTC\"           | `:zone_abbr` key, unlocalised      |\n|                         | zzzz      | \"GMT\"           | Delegates to `zone_gmt/4`          |\n| Timezone ID             | V         | \"unk\"           | `:zone_abbr` key, unlocalised      |\n|                         | VV        | \"Etc/UTC        | Delegates to `zone_gmt/4`          |\n|                         | VVV       | \"Unknown City\"  | Exemplar city.  Not supported.     |\n|                         | VVVV      | \"GMT\"           | Delegates to `zone_gmt/4           |\n| ISO8601 Format          | Z..ZZZ    | \"+0100\"         | ISO8601 Basic Format with hours and minutes |\n|                         | ZZZZ      | \"+01:00\"        | Delegates to `zone_gmt/4           |\n|                         | ZZZZZ     | \"+01:00:10\"     | ISO8601 Extended format with optional seconds |\n| ISO8601 plus Z          | X         | \"+01\"           | ISO8601 Basic Format with hours and optional minutes or \"Z\" |\n|                         | XX        | \"+0100\"         | ISO8601 Basic Format with hours and minutes or \"Z\"          |\n|                         | XXX       | \"+0100\"         | ISO8601 Basic Format with hours and minutes, optional seconds or \"Z\" |\n|                         | XXXX      | \"+010059\"       | ISO8601 Basic Format with hours and minutes, optional seconds or \"Z\" |\n|                         | XXXXX     | \"+01:00:10\"     | ISO8601 Extended Format with hours and minutes, optional seconds or \"Z\" |\n| ISO8601 minus Z         | x         | \"+0100\"         | ISO8601 Basic Format with hours and optional minutes |\n|                         | xx        | \"-0800\"         | ISO8601 Basic Format with hours and minutes          |\n|                         | xxx       | \"+01:00\"        | ISO8601 Extended Format with hours and minutes       |\n|                         | xxxx      | \"+010059\"       | ISO8601 Basic Format with hours and minutes, optional seconds     |\n|                         | xxxxx     | \"+01:00:10\"     | ISO8601 Extended Format with hours and minutes, optional seconds  |\n| GMT Format              | O         | \"+0100\"         | Short localised GMT format        |\n|                         | OOOO      | \"+010059\"       | Long localised GMT format         |\n\n## Formatting symbols for hour of day\n\nThe hour of day can be formatted differently depending whether\na 12- or 24-hour day is being represented and depending on the\nway in which midnight and noon are represented.  The following\ntable illustrates the differences:\n\n| Symbol  | Midn.\t|\tMorning\t| Noon |\tAfternoon\t| Midn. |\n| :----:  | :---: | :-----: | :--: | :--------: | :---: |\n|   h\t    |  12\t  | 1...11\t|  12\t |   1...11   |  12   |\n|   K\t    |   0\t  | 1...11\t|   0\t |   1...11   |   0   |\n|   H\t    |   0\t  | 1...11\t|  12\t |  13...23   |   0   |\n|   k\t    |  24\t  | 1...11\t|  12\t |  13...23   |  24   |\n\n## Relative Date, Time and DateTime Localization Formatting\n\nThe primary API for formatting relative dates and datetimes is `MyApp.Cldr.DateTime.Relative.to_string/2`.  Some examples:\n\n```elixir\niex\u003e MyApp.Cldr.DateTime.Relative.to_string(-1)\n{:ok, \"1 second ago\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string(1)\n{:ok, \"in 1 second\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string(1, unit: :day)\n{:ok, \"tomorrow\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string(1, unit: :day, locale: \"fr\")\n{:ok, \"demain\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string(1, unit: :day, format: :narrow)\n{:ok, \"tomorrow\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string(1234, unit: :year)\n{:ok, \"in 1,234 years\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string(1234, unit: :year, locale: \"fr\")\n{:ok, \"dans 1 234 ans\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string(31)\n{:ok, \"in 31 seconds\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string(~D[2017-04-29], relative_to: ~D[2017-04-26])\n{:ok, \"in 3 days\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string(310, format: :short, locale: \"fr\")\n{:ok, \"dans 5 min\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string(310, format: :narrow, locale: \"fr\")\n{:ok, \"+5 min\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string 2, unit: :wed, format: :short\n{:ok, \"in 2 Wed.\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string 1, unit: :wed, format: :short\n{:ok, \"next Wed.\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string -1, unit: :wed, format: :short\n{:ok, \"last Wed.\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string -1, unit: :wed\n{:ok, \"last Wednesday\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string -1, unit: :quarter\n{:ok, \"last quarter\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string -1, unit: :mon, locale: \"fr\"\n{:ok, \"lundi dernier\"}\n\niex\u003e MyApp.Cldr.DateTime.Relative.to_string(~D[2017-04-29], unit: :ziggeraut)\n{:error, {Cldr.UnknownTimeUnit,\n\"Unknown time unit :ziggeraut.  Valid time units are [:day, :hour, :minute, :month, :second, :week, :year, :mon, :tue, :wed, :thu, :fri, :sat, :sun, :quarter]\"}}\n```\n\n## Interval Formatting\n\nInterval formats allow for software to format intervals like \"Jan 10-12, 2008\" as a shorter and more natural format than \"Jan 10, 2008 - Jan 12, 2008\". They are designed to take a start and end date, time or datetime plus a formatting pattern and use that information to produce a localized format.\n\nAn interval is expressed as either a `from` and `to` date, time or datetime. Or it can also be a `Date.Range` or `CalendarInterval` from the [calendar_interval](https://hex.pm/packages/calendar_interval) library.\n\n`Cldr.Interval.to_string/3` function to format an interval based upon the type of the arguments: date, datetime or time.  The modules `Cldr.Date.Interval`, `Cldr.Time.Interval` and `Cldr.DateTime.Interval` also provide a `to_string/3` function for when the desired output format is more specific.\n\nSome examples:\n\n```elixir\niex\u003e Cldr.Interval.to_string ~D[2020-01-01], ~D[2020-12-31], MyApp.Cldr\n{:ok, \"Jan 1 – Dec 31, 2020\"}\n\niex\u003e Cldr.Interval.to_string ~D[2020-01-01], ~D[2020-01-12], MyApp.Cldr\n{:ok, \"Jan 1 – 12, 2020\"}\n\niex\u003e Cldr.Interval.to_string ~D[2020-01-01], ~D[2020-01-12], MyApp.Cldr,\n...\u003e format: :long\n{:ok, \"Wed, Jan 1 – Sun, Jan 12, 2020\"}\n\niex\u003e Cldr.Interval.to_string ~D[2020-01-01], ~D[2020-12-01], MyApp.Cldr,\n...\u003e format: :long, style: :year_and_month\n{:ok, \"January – December 2020\"}\n\niex\u003e use CalendarInterval\niex\u003e Cldr.Interval.to_string ~I\"2020-01-01/12\", MyApp.Cldr,\n...\u003e format: :long\n{:ok, \"Wed, Jan 1 – Sun, Jan 12, 2020\"}\n\niex\u003e Cldr.Interval.to_string ~U[2020-01-01 00:00:00.0Z], ~U[2020-12-01 10:05:00.0Z], MyApp.Cldr,\n...\u003e format: :long\n{:ok, \"January 1, 2020 at 12:00:00 AM UTC – December 1, 2020 at 10:05:00 AM UTC\"}\n\niex\u003e Cldr.Interval.to_string ~U[2020-01-01 00:00:00.0Z], ~U[2020-01-01 10:05:00.0Z], MyApp.Cldr,\n...\u003e format: :long\n{:ok, \"January 1, 2020 at 12:00:00 AM UTC – 10:05:00 AM UTC\"}\n```\n\n## Known restrictions and limitations\n\nAlthough largely complete (with respect to the CLDR data), there are some known limitations as of release 2.0.\n\n* *Timezones*  Although the timezone format codes are supported (formatting symbols `v`, `V`, `x`, `X`, `z`, `Z`, `O`) not all localisations are performed.  Only that data available within a `t:DateTime.t/0` struct is used to format timezone data.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-cldr%2Fcldr_dates_times","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felixir-cldr%2Fcldr_dates_times","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felixir-cldr%2Fcldr_dates_times/lists"}