Cldr Dates Times version 2.23.0
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
Sformat code which formats fractional seconds. In previous versions,Swas formatted to include both the number of seconds and the fraction of a second. This is incorrect according to TR 35. Now theSformats only the fraction of a second. In addition, the fraction of a second is truncated (previously rounded) and right-filled with0characters 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/2to 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_fromoption toCldr.DateTime.Relative.to_string/3function. 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/1Cldr.DateTime.Format.date_format/1Cldr.DateTime.Format.date_time_format/1
-
Adds support for
t:Time.t/0arguments toCldr.DateTime.Relative.to_string/3.