Skip to content

Commit

Permalink
Release 2.15.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kipcole9 committed Oct 16, 2023
1 parent ce18e4c commit 8e29db7
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

## Cldr_Dates_Times v2.15.0

This is the changelog for Cldr_Dates_Times v2.15.0 released on _____, 2023. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_cldr_dates_times/tags)
This is the changelog for Cldr_Dates_Times v2.15.0 released on October 17th, 2023. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_cldr_dates_times/tags)

### Deprecations

* The support of `:style` as a synonym for `:format` with the functions `Cldr.Time.to_string/2`, `Cldr.Date.to_string/2` and `Cldr.DateTime.to_string/2` is now removed. The `:style` option is now used influence the use of "at" formats in `Cldr.DateTime.to_string/2`. `:style` also remains a valid option for interval formatting.
* The support of `:style` as a synonym for `:format` with the functions `Cldr.Time.to_string/2`, `Cldr.Date.to_string/2` and `Cldr.DateTime.to_string/2` is now removed. The `:style` option is now used to influence the use of "at" formats in `Cldr.DateTime.to_string/2`. `:style` also remains a valid option for interval formatting.

### Enhancements

Expand Down
22 changes: 13 additions & 9 deletions lib/cldr/datetime.ex
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ defmodule Cldr.DateTime do
The default is `:medium`.
* `:style` is either `:at` or `:default`. When set to `:at` the datetime is
formatted with a localised string representing `<date> at `<time>`. See
formatted with a localised string representing `<date> at <time>`. See
`Cldr.DateTime.Format.date_time_at_formats/2`.
* `:locale` is any valid locale name returned by `Cldr.known_locale_names/0`
Expand All @@ -75,18 +75,22 @@ defmodule Cldr.DateTime do
## Examples
iex> {:ok, datetime} = DateTime.from_naive(~N[2000-01-01 23:59:59.0], "Etc/UTC")
iex> Cldr.DateTime.to_string datetime
iex> Cldr.DateTime.to_string(datetime)
{:ok, "Jan 1, 2000, 11:59:59 PM"}
iex> Cldr.DateTime.to_string datetime, MyApp.Cldr, locale: "en"
iex> Cldr.DateTime.to_string(datetime, MyApp.Cldr, locale: "en")
{:ok, "Jan 1, 2000, 11:59:59 PM"}
iex> Cldr.DateTime.to_string datetime, MyApp.Cldr, format: :long, locale: "en"
iex> Cldr.DateTime.to_string(datetime, MyApp.Cldr, format: :long, locale: "en")
{:ok, "January 1, 2000, 11:59:59 PM UTC"}
iex> Cldr.DateTime.to_string datetime, MyApp.Cldr, format: :hms, locale: "en"
iex> Cldr.DateTime.to_string(datetime, MyApp.Cldr, format: :hms, locale: "en")
{:ok, "11:59:59 PM"}
iex> Cldr.DateTime.to_string datetime, MyApp.Cldr, format: :full, locale: "en"
iex> Cldr.DateTime.to_string(datetime, MyApp.Cldr, format: :full, locale: "en")
{:ok, "Saturday, January 1, 2000, 11:59:59 PM GMT"}
iex> Cldr.DateTime.to_string datetime, MyApp.Cldr, format: :full, locale: "fr"
iex> Cldr.DateTime.to_string(datetime, MyApp.Cldr, format: :full, locale: "fr")
{:ok, "samedi 1 janvier 2000, 23:59:59 UTC"}
iex> Cldr.DateTime.to_string(datetime, MyApp.Cldr, format: :full, style: :at, locale: "en")
{:ok, "Saturday, January 1, 2000 at 11:59:59 PM GMT"}
iex> Cldr.DateTime.to_string(datetime, MyApp.Cldr, format: :full, style: :at, locale: "fr")
{:ok, "samedi 1 janvier 2000 à 23:59:59 UTC"}
"""
@spec to_string(map, Cldr.backend() | Keyword.t(), Keyword.t()) ::
Expand Down Expand Up @@ -185,7 +189,7 @@ defmodule Cldr.DateTime do
The default is `:medium`.
* `:style` is either `:at` or `:default`. When set to `:at` the datetime is
formatted with a localised string representing `<date> at `<time>`. See
formatted with a localised string representing `<date> at <time>`. See
`Cldr.DateTime.Format.date_time_at_formats/2`.
* `:locale` is any valid locale name returned by `Cldr.known_locale_names/0`
Expand Down Expand Up @@ -258,7 +262,7 @@ defmodule Cldr.DateTime do
else
{:error,
{Cldr.DateTime.InvalidStyle,
"Invalid datetime style #{inspect(format)}. " <>
"Invalid datetime format #{inspect(format)}. " <>
"The valid formaats are #{inspect(formats)}."}}
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/cldr/time.ex
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ defmodule Cldr.Time do

@doc """
Formats a time according to a format string
as defined in CLDR and described in [TR35](http://unicode.org/reports/tr35/tr35-dates.html)
as defined in CLDR and described in [TR35](http://unicode.org/reports/tr35/tr35-dates.html).
## Returns
Expand All @@ -49,10 +49,10 @@ defmodule Cldr.Time do
## Options
* `:format` is one of `:short`, `:medium`, `:long`,`:full` or a format string.
* `:format` is one of `:short`, `:medium`, `:long`, `:full` or a format string.
The default is `:medium`.
* `:locale` any locale returned by `Cldr.known_locale_names/1`. The default is `
* `:locale` any locale returned by `Cldr.known_locale_names/1`. The default is
`Cldr.get_locale/0`.
* `:number_system` a number system into which the formatted date digits should
Expand All @@ -63,7 +63,7 @@ defmodule Cldr.Time do
* `period: :variant` will use a variant for the time period and flexible time period if
one is available in the locale. For example, in the "en" locale `period: :variant` will
return "pm" instead of "PM"
return "pm" instead of "PM".
## Examples
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defmodule Cldr.DatesTimes.Mixfile do
use Mix.Project

@version "2.15.0-dev"
@version "2.15.0"

def project do
[
Expand Down

0 comments on commit 8e29db7

Please sign in to comment.