diff --git a/CHANGELOG.md b/CHANGELOG.md index 362dab9..2a2c141 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,18 @@ **Note that `ex_cldr_calendars` version 1.24.0 and later are supported on Elixir 1.12 and later only.** +## Cldr.Calendars v1.26.0 + +This is the changelog for Cldr Calendars v1.26.0 released on July 27th, 2024. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_calendars/tags) + +### Bug Fixes + +* Microseconds in `t:Cldr.Calendar.Duration.t/0` now follow the `t:Time.t/0` expectations. + +### Enhancements + +* Adds `Cldr.Calendar.Duration.new_from_seconds/1` + ## Cldr.Calendars v1.25.2 This is the changelog for Cldr Calendars v1.25.2 released on July 9th, 2024. For older changelogs please consult the release tag on [GitHub](https://github.com/elixir-cldr/cldr_calendars/tags) diff --git a/lib/cldr/calendar.ex b/lib/cldr/calendar.ex index 2541e43..c6b3227 100644 --- a/lib/cldr/calendar.ex +++ b/lib/cldr/calendar.ex @@ -2377,10 +2377,14 @@ defmodule Cldr.Calendar do @doc since: "1.19.0" @spec localize(any_date_time()) :: - {:ok, any_date_time()} | {:error, :incompatible_calendars} | {:error, {module(), String.t()}} + {:ok, any_date_time()} + | {:error, :incompatible_calendars} + | {:error, {module(), String.t()}} @spec localize(any_date_time(), Keyword.t() | atom()) :: - {:ok, any_date_time()} | {:error, :incompatible_calendars} | {:error, {module(), String.t()}} + {:ok, any_date_time()} + | {:error, :incompatible_calendars} + | {:error, {module(), String.t()}} @spec localize(any_date_time(), atom(), Keyword.t()) :: String.t() | {:error, :incompatible_calendars} | {:error, {module(), String.t()}} @@ -2478,7 +2482,7 @@ defmodule Cldr.Calendar do """ @spec localize(datetime :: any_date_time(), part :: part(), options :: Keyword.t()) :: - String.t() | [day_of_week_to_binary()] | {:error, {module(), String.t()}} + String.t() | {:error, {module(), String.t()}} def localize(datetime, part, options \\ []) diff --git a/lib/cldr/calendar/backend/calendar.ex b/lib/cldr/calendar/backend/calendar.ex index 2913eef..fe7b6a0 100644 --- a/lib/cldr/calendar/backend/calendar.ex +++ b/lib/cldr/calendar/backend/calendar.ex @@ -69,10 +69,14 @@ defmodule Cldr.Calendar.Backend do @doc since: "1.25.0" @spec localize(Cldr.Calendar.any_date_time()) :: - {:ok, Elixir.Date.t()} | {:error, :incompatible_calendars} | {:error, {module(), String.t()}} + {:ok, Elixir.Date.t()} + | {:error, :incompatible_calendars} + | {:error, {module(), String.t()}} @spec localize(Cldr.Calendar.any_date_time(), Keyword.t() | Cldr.Calendar.part()) :: - {:ok, Elixir.Date.t()} | {:error, :incompatible_calendars} | {:error, {module(), String.t()}} + {:ok, Elixir.Date.t()} + | {:error, :incompatible_calendars} + | {:error, {module(), String.t()}} @spec localize(Cldr.Calendar.any_date_time(), Cldr.Calendar.part(), Keyword.t()) :: String.t() | {:error, :incompatible_calendars} | {:error, {module(), String.t()}} diff --git a/lib/cldr/calendar/duration.ex b/lib/cldr/calendar/duration.ex index 66c08ff..5c35a87 100644 --- a/lib/cldr/calendar/duration.ex +++ b/lib/cldr/calendar/duration.ex @@ -29,7 +29,7 @@ defmodule Cldr.Calendar.Duration do """ - @struct_list [year: 0, month: 0, day: 0, hour: 0, minute: 0, second: 0, microsecond: 0] + @struct_list [year: 0, month: 0, day: 0, hour: 0, minute: 0, second: 0, microsecond: {0, 6}] @keys Keyword.keys(@struct_list) defstruct @struct_list @@ -41,7 +41,7 @@ defmodule Cldr.Calendar.Duration do hour: non_neg_integer(), minute: non_neg_integer(), second: non_neg_integer(), - microsecond: non_neg_integer() + microsecond: {integer(), 1..6} } @typedoc "A date, time, naivedatetime or datetime" @@ -108,7 +108,10 @@ defmodule Cldr.Calendar.Duration do def to_string(%__MODULE__{} = duration, options \\ []) do {except, options} = Keyword.pop(options, :except, []) - for key <- @keys, value = Map.get(duration, key), value != 0 && key not in except do + for key <- @keys, + value = Map.get(duration, key), + maybe_extract_microseconds(key, value) != 0 && key not in except do + value = maybe_extract_microseconds(key, value) Cldr.Unit.new!(key, value) end |> Cldr.Unit.to_string(options) @@ -154,7 +157,10 @@ defmodule Cldr.Calendar.Duration do except = Keyword.get(options, :except, []) formatted = - for key <- @keys, value = Map.get(duration, key), value != 0 && key not in except do + for key <- @keys, + value = Map.get(duration, key), + maybe_extract_microseconds(key, value) != 0 && key not in except do + value = maybe_extract_microseconds(key, value) if value > 1, do: "#{value} #{key}s", else: "#{value} #{key}" end |> Enum.join(", ") @@ -163,6 +169,9 @@ defmodule Cldr.Calendar.Duration do end end + defp maybe_extract_microseconds(:microsecond, {microseconds, _precision}), do: microseconds + defp maybe_extract_microseconds(_any, value), do: value + @doc """ Formats a duration as a string or raises an exception on error. @@ -233,7 +242,7 @@ defmodule Cldr.Calendar.Duration do month: 11, day: 30, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, second: 0 }} @@ -272,7 +281,7 @@ defmodule Cldr.Calendar.Duration do hour: hours, minute: minutes, second: seconds, - microsecond: microseconds + microsecond: microsecond_precision(microseconds) )} end end @@ -311,16 +320,16 @@ defmodule Cldr.Calendar.Duration do month: 11, day: 30, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, second: 0 }} """ - @spec new(interval()) :: {:ok, t()} | {:error, {module(), String.t()}} + @spec new(interval :: interval()) :: {:ok, t()} | {:error, {module(), String.t()}} if Code.ensure_loaded?(CalendarInterval) do - def new(%CalendarInterval{first: first, last: last, precision: precision}) + def new(%CalendarInterval{first: first, last: last, precision: precision} = _interval) when precision in [:year, :month, :day] do first = %{first | hour: 0, minute: 0, second: 0, microsecond: {0, 6}} last = %{last | hour: 0, minute: 0, second: 0, microsecond: {0, 6}} @@ -354,6 +363,82 @@ defmodule Cldr.Calendar.Duration do "The two dates must be in the same calendar. Found #{inspect(from)} and #{inspect(to)}"}} end + @doc """ + Returns a duration calculated from a number of seconds. + + The duration will be calculated in hours, minutes, + seconds and microseconds only. + + ### Arguments + + * `seconds` is a number of seconds as a float or + integer. + + ### Returns + + * a `t:Cldr.Calendar.Duration.t/0` + + ### Example + + iex> Cldr.Calendar.Duration.new_from_seconds(36092.1) + %Cldr.Calendar.Duration{ + year: 0, + month: 0, + day: 0, + hour: 10, + minute: 1, + second: 32, + microsecond: {100000, 1} + } + + """ + @doc since: "1.26.0" + @spec new_from_seconds(seconds :: number()) :: t() + def new_from_seconds(seconds) when is_number(seconds) do + microseconds = microseconds_from_fraction(seconds) + seconds = trunc(seconds) + hours = div(seconds, 3600) + remainder = rem(seconds, 3600) + minutes = div(remainder, 60) + seconds = rem(remainder, 60) + + %__MODULE__{ + year: 0, + month: 0, + day: 0, + hour: hours, + minute: minutes, + second: seconds, + microsecond: microseconds + } + end + + defp microseconds_from_fraction(number) do + fraction = Cldr.Digits.fraction_as_integer(number) + + cond do + fraction == 0 -> {0, 6} + fraction < 10 -> {fraction * 100_000, 1} + fraction < 100 -> {fraction * 10_000, 2} + fraction < 1_000 -> {fraction * 1_000, 3} + fraction < 10_000 -> {fraction * 100, 4} + fraction < 100_000 -> {fraction * 10, 5} + fraction <= 1_000_000 -> {fraction, 6} + end + end + + defp microsecond_precision(microseconds) do + cond do + microseconds == 0 -> {0, 6} + microseconds < 10 -> {microseconds, 1} + microseconds < 100 -> {microseconds, 2} + microseconds < 1_000 -> {microseconds, 3} + microseconds < 10_000 -> {microseconds, 4} + microseconds < 100_000 -> {microseconds, 5} + microseconds <= 1_000_000 -> {microseconds, 6} + end + end + defp cast_date_time(unquote(Cldr.Calendar.datetime()) = datetime) do _ = calendar {:ok, datetime} @@ -430,7 +515,7 @@ defmodule Cldr.Calendar.Duration do ## Returns - * A `duration` struct or + * A `t:Cldr.Calendar.Duration.t/0` struct or * raises an exception @@ -442,7 +527,7 @@ defmodule Cldr.Calendar.Duration do month: 11, day: 30, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, second: 0 } @@ -474,7 +559,7 @@ defmodule Cldr.Calendar.Duration do ## Returns - * A `duration` struct or + * A `t:Cldr.Calendar.Duration.t/0` struct or * raises an exception @@ -492,7 +577,7 @@ defmodule Cldr.Calendar.Duration do month: 11, day: 30, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, second: 0 } @@ -592,6 +677,6 @@ defmodule Cldr.Calendar.Duration do |> Map.put(:hour, hours) |> Map.put(:minute, minutes) |> Map.put(:second, seconds) - |> Map.put(:microsecond, microseconds) + |> Map.put(:microsecond, microsecond_precision(microseconds)) end end diff --git a/mix.exs b/mix.exs index 95fdd99..1365796 100644 --- a/mix.exs +++ b/mix.exs @@ -1,7 +1,7 @@ defmodule Cldr.Calendar.MixProject do use Mix.Project - @version "1.25.2" + @version "1.26.0" def project do [ diff --git a/mix.lock b/mix.lock index 181936e..7a8ddec 100644 --- a/mix.lock +++ b/mix.lock @@ -2,7 +2,6 @@ "benchee": {:hex, :benchee, "1.3.1", "c786e6a76321121a44229dde3988fc772bca73ea75170a73fd5f4ddf1af95ccf", [:mix], [{:deep_merge, "~> 1.0", [hex: :deep_merge, repo: "hexpm", optional: false]}, {:statistex, "~> 1.0", [hex: :statistex, repo: "hexpm", optional: false]}, {:table, "~> 0.1.0", [hex: :table, repo: "hexpm", optional: true]}], "hexpm", "76224c58ea1d0391c8309a8ecbfe27d71062878f59bd41a390266bf4ac1cc56d"}, "calendar_interval": {:hex, :calendar_interval, "0.2.0", "2b253b1e37ee1d4344639a3cbfb12abd0e996e4a8181537eb33c3e93fdfaffd9", [:mix], [], "hexpm", "c13d5e0108e61808a38f622987e1c5e881d96d28945213d3efe6dd06c28ba7b0"}, "cldr_utils": {:hex, :cldr_utils, "2.28.1", "3d85c835e1d0b7bceb9feed1647025ff7df59180246f13b582422f12b1afd52c", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:certifi, "~> 2.5", [hex: :certifi, repo: "hexpm", optional: true]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}], "hexpm", "79a5f645481d09b1372962384aa275d67d69273e73e3b38a9fee363eb57c2b79"}, - "coerce": {:hex, :coerce, "1.0.1", "211c27386315dc2894ac11bc1f413a0e38505d808153367bd5c6e75a4003d096", [:mix], [], "hexpm", "b44a691700f7a1a15b4b7e2ff1fa30bebd669929ac8aa43cffe9e2f8bf051cf1"}, "decimal": {:hex, :decimal, "2.1.1", "5611dca5d4b2c3dd497dec8f68751f1f1a54755e8ed2a966c2633cf885973ad6", [:mix], [], "hexpm", "53cfe5f497ed0e7771ae1a475575603d77425099ba5faef9394932b35020ffcc"}, "deep_merge": {:hex, :deep_merge, "1.0.0", "b4aa1a0d1acac393bdf38b2291af38cb1d4a52806cf7a4906f718e1feb5ee961", [:mix], [], "hexpm", "ce708e5f094b9cd4e8f2be4f00d2f4250c4095be93f8cd6d018c753894885430"}, "dialyxir": {:hex, :dialyxir, "1.4.3", "edd0124f358f0b9e95bfe53a9fcf806d615d8f838e2202a9f430d59566b6b53b", [:mix], [{:erlex, ">= 0.2.6", [hex: :erlex, repo: "hexpm", optional: false]}], "hexpm", "bf2cfb75cd5c5006bec30141b131663299c661a864ec7fbbc72dfa557487a986"}, @@ -20,9 +19,6 @@ "makeup_elixir": {:hex, :makeup_elixir, "0.16.2", "627e84b8e8bf22e60a2579dad15067c755531fea049ae26ef1020cad58fe9578", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "41193978704763f6bbe6cc2758b84909e62984c7752b3784bd3c218bb341706b"}, "makeup_erlang": {:hex, :makeup_erlang, "1.0.1", "c7f58c120b2b5aa5fd80d540a89fdf866ed42f1f3994e4fe189abebeab610839", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "8a89a1eeccc2d798d6ea15496a6e4870b75e014d1af514b1b71fa33134f57814"}, "nimble_parsec": {:hex, :nimble_parsec, "1.4.0", "51f9b613ea62cfa97b25ccc2c1b4216e81df970acd8e16e8d1bdc58fef21370d", [:mix], [], "hexpm", "9c565862810fb383e9838c1dd2d7d2c437b3d13b267414ba6af33e50d2d1cf28"}, - "nimble_strftime": {:hex, :nimble_strftime, "0.1.1", "b988184d1bd945bc139b2c27dd00a6c0774ec94f6b0b580083abd62d5d07818b", [:mix], [], "hexpm", "89e599c9b8b4d1203b7bb5c79eb51ef7c6a28fbc6228230b312f8b796310d755"}, - "numbers": {:hex, :numbers, "5.2.4", "f123d5bb7f6acc366f8f445e10a32bd403c8469bdbce8ce049e1f0972b607080", [:mix], [{:coerce, "~> 1.0", [hex: :coerce, repo: "hexpm", optional: false]}, {:decimal, "~> 1.9 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "eeccf5c61d5f4922198395bf87a465b6f980b8b862dd22d28198c5e6fab38582"}, - "ratio": {:hex, :ratio, "3.0.2", "60a5976872a4dc3d873ecc57eed1738589e99d1094834b9c935b118231297cfb", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}, {:numbers, "~> 5.2.0", [hex: :numbers, repo: "hexpm", optional: false]}], "hexpm", "3a13ed5a30ad0bfd7e4a86bf86d93d2b5a06f5904417d38d3f3ea6406cdfc7bb"}, "statistex": {:hex, :statistex, "1.0.0", "f3dc93f3c0c6c92e5f291704cf62b99b553253d7969e9a5fa713e5481cd858a5", [:mix], [], "hexpm", "ff9d8bee7035028ab4742ff52fc80a2aa35cece833cf5319009b52f1b5a86c27"}, "stream_data": {:hex, :stream_data, "1.1.1", "fd515ca95619cca83ba08b20f5e814aaf1e5ebff114659dc9731f966c9226246", [:mix], [], "hexpm", "45d0cd46bd06738463fd53f22b70042dbb58c384bb99ef4e7576e7bb7d3b8c8c"}, "tz": {:hex, :tz, "0.27.1", "d8091d0c2d4f590e010c94830c3d842f548b4872a5b92028d74f0d0a3887aebe", [:mix], [{:castore, "~> 0.1 or ~> 1.0", [hex: :castore, repo: "hexpm", optional: true]}, {:mint, "~> 1.6", [hex: :mint, repo: "hexpm", optional: true]}], "hexpm", "215c9120dab5b7f7db4c93e91085c290b2efe478e147d84285a6583fd220727f"}, diff --git a/test/duration_test.exs b/test/duration_test.exs index feffff0..bab0bc5 100644 --- a/test/duration_test.exs +++ b/test/duration_test.exs @@ -8,7 +8,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 26, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 9, second: 0, @@ -18,7 +18,7 @@ defmodule Cldr.Calendar.Duration.Test do assert Cldr.Calendar.plus(~D[1999-02-03], %Cldr.Calendar.Duration{ day: 26, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 9, second: 0, @@ -29,7 +29,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 6, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 6, second: 0, @@ -39,7 +39,7 @@ defmodule Cldr.Calendar.Duration.Test do assert Cldr.Calendar.plus(~D"1984-02-14", %Cldr.Calendar.Duration{ day: 6, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 6, second: 0, @@ -50,7 +50,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 0, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 1, second: 0, @@ -60,7 +60,7 @@ defmodule Cldr.Calendar.Duration.Test do assert Cldr.Calendar.plus(~D"1960-06-14", %Cldr.Calendar.Duration{ day: 0, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 1, second: 0, @@ -71,7 +71,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 8, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 2, second: 0, @@ -81,7 +81,7 @@ defmodule Cldr.Calendar.Duration.Test do assert Cldr.Calendar.plus(~D"1960-05-05", %Cldr.Calendar.Duration{ day: 8, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 2, second: 0, @@ -97,7 +97,7 @@ defmodule Cldr.Calendar.Duration.Test do month: 11, day: 30, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, second: 0 }} @@ -106,19 +106,43 @@ defmodule Cldr.Calendar.Duration.Test do test "datetime duration one day crossing month boundary" do assert Duration.new(~D[2019-01-31], ~D[2019-02-01]) == {:ok, - %Duration{year: 0, month: 0, day: 1, hour: 0, microsecond: 0, minute: 0, second: 0}} + %Duration{ + year: 0, + month: 0, + day: 1, + hour: 0, + microsecond: {0, 6}, + minute: 0, + second: 0 + }} end test "datetime one day crossing year boundary" do assert Duration.new(~D[2019-12-31], ~D[2020-01-01]) == {:ok, - %Duration{year: 0, month: 0, day: 1, hour: 0, microsecond: 0, minute: 0, second: 0}} + %Duration{ + year: 0, + month: 0, + day: 1, + hour: 0, + microsecond: {0, 6}, + minute: 0, + second: 0 + }} end test "datetime duration month and day incremented" do assert Duration.new(~D[2019-05-27], ~D[2019-08-30]) == {:ok, - %Duration{year: 0, month: 3, day: 3, hour: 0, microsecond: 0, minute: 0, second: 0}} + %Duration{ + year: 0, + month: 3, + day: 3, + hour: 0, + microsecond: {0, 6}, + minute: 0, + second: 0 + }} end test "datetime duration month and day also incremented to last day of year" do @@ -129,7 +153,7 @@ defmodule Cldr.Calendar.Duration.Test do month: 7, day: 30, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, second: 0 }} @@ -143,7 +167,7 @@ defmodule Cldr.Calendar.Duration.Test do month: 1, day: 30, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, second: 0 }} @@ -160,7 +184,7 @@ defmodule Cldr.Calendar.Duration.Test do month: 1, day: 30, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, second: 0 }} @@ -172,7 +196,15 @@ defmodule Cldr.Calendar.Duration.Test do date(2019, 01, 07, Cldr.Calendar.CSCO) ) == {:ok, - %Duration{year: 18, month: 1, day: 6, hour: 0, microsecond: 0, minute: 0, second: 0}} + %Duration{ + year: 18, + month: 1, + day: 6, + hour: 0, + microsecond: {0, 6}, + minute: 0, + second: 0 + }} end test "duration with the same month and day 2 later than day 1" do @@ -186,7 +218,7 @@ defmodule Cldr.Calendar.Duration.Test do month: 0, day: 2, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, second: 0 }} @@ -253,7 +285,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 0, hour: 1, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 0, second: 0, @@ -265,7 +297,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 0, hour: 1, - microsecond: 0, + microsecond: {0, 6}, minute: 2, month: 0, second: 0, @@ -277,7 +309,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 0, hour: 1, - microsecond: 0, + microsecond: {0, 6}, minute: 2, month: 0, second: 3, @@ -304,7 +336,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 0, hour: 23, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 0, second: 0, @@ -316,7 +348,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 0, hour: 22, - microsecond: 0, + microsecond: {0, 6}, minute: 58, month: 0, second: 0, @@ -328,7 +360,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 0, hour: 22, - microsecond: 0, + microsecond: {0, 6}, minute: 57, month: 0, second: 58, @@ -340,7 +372,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 0, hour: 22, - microsecond: 0, + microsecond: {0, 6}, minute: 56, month: 0, second: 56, @@ -354,7 +386,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 30, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 11, second: 0, @@ -370,7 +402,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 30, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 11, second: 0, @@ -384,7 +416,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 0, hour: 0, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 0, second: 24, @@ -398,7 +430,7 @@ defmodule Cldr.Calendar.Duration.Test do %Cldr.Calendar.Duration{ day: 0, hour: -1, - microsecond: 0, + microsecond: {0, 6}, minute: 0, month: 0, second: 0,