diff --git a/lib/cldr/interval.ex b/lib/cldr/interval.ex index 5aa5293..f9f9325 100644 --- a/lib/cldr/interval.ex +++ b/lib/cldr/interval.ex @@ -443,6 +443,13 @@ defmodule Cldr.Interval do to = %{to | second: 0, microsecond: {0, 6}} Cldr.DateTime.Interval.to_string(from, to, backend, options) end + + def to_string(%CalendarInterval{first: from, last: to, precision: precision}, backend, options) + when precision in [:second, :microsecond] do + from = %{from | microsecond: {0, 6}} + to = %{to | microsecond: {0, 6}} + Cldr.DateTime.Interval.to_string(from, to, backend, options) + end end @doc false diff --git a/lib/cldr/interval/date_time.ex b/lib/cldr/interval/date_time.ex index 096ab40..19f4380 100644 --- a/lib/cldr/interval/date_time.ex +++ b/lib/cldr/interval/date_time.ex @@ -106,7 +106,7 @@ defmodule Cldr.DateTime.Interval do end def to_string(%CalendarInterval{first: from, last: to, precision: precision}, backend, options) - when precision in [:hour, :minute] do + when precision in [:hour, :minute, :second] do to_string(from, to, backend, options) end end @@ -324,7 +324,7 @@ defmodule Cldr.DateTime.Interval do end def to_string!(%CalendarInterval{first: from, last: to, precision: precision}, backend, options) - when precision in [:hour, :minute] do + when precision in [:hour, :minute, :second] do to_string!(from, to, backend, options) end end