Skip to content

Cldr Dates Times version 2.23.0

Choose a tag to compare

@kipcole9 kipcole9 released this 26 Aug 23:13
· 64 commits to main since this release

Breaking change to S format code implementation

This release fixes a long-standing bug in the formatting of the S (fractional second) format code. Any applications relying on the previous incorrect implementation will need updating.

Bug Fixes

  • Fixes formatting of the S format code which formats fractional seconds. In previous versions, S was formatted to include both the number of seconds and the fraction of a second. This is incorrect according to TR 35. Now the S formats only the fraction of a second. In addition, the fraction of a second is truncated (previously rounded) and right-filled with 0 characters if required. See also the formatter documentation for further information. Thanks to @jswanner for the report. Closes #55.

Enhancements

  • Adds support for localized time zone names in Cldr.DateTime.Timezone. This module supports formatting of a time zone in the following formats:

    • Generic non-location format
    • Generic partial location format
    • Generic location format
    • Specific non-location format
    • Specific location format
    • Localized GMT format
  • Adds Cldr.DateTime.Timezone.preferred_zone_for_locale/2 to return the preferred time zone name for a given zone and locale. This function is useful when the same time zone has different names in different locales. For example:

iex> Cldr.DateTime.Timezone.preferred_zone_for_locale("America/New_York", locale: "en")
{:ok, "America/New_York"}

iex> Cldr.DateTime.Timezone.preferred_zone_for_locale("America/New_York", locale: "en-CA")
{:ok, "America/Toronto"}
  • Implements user-specified relative time steps as the :derive_unit_from option to Cldr.DateTime.Relative.to_string/3 function. This allows developers to specify when a relative time interval steps from seconds to minutes to days and so on. Thanks to @tjchambers for the collaboration and patience. Closes #54.

  • Adds functions to return a specific format string for time, date and datetime. Thanks to @tjchambers for the collaboration. Closes #57. See:

    • Cldr.DateTime.Format.time_format/1
    • Cldr.DateTime.Format.date_format/1
    • Cldr.DateTime.Format.date_time_format/1
  • Adds support for t:Time.t/0 arguments to Cldr.DateTime.Relative.to_string/3.