Cldr.Calendar.Duration.new-exclamation-mark
You're seeing just the function
new-exclamation-mark, go back to Cldr.Calendar.Duration module for more information.
Specs
Calculates the calendar difference in
a Date.Range or CalendarInterval
returning a Duration struct.
The difference calculated is in terms of years, months, days, hours, minutes, seconds and microseconds.
Arguments
intervalis eitherDate.Range.t()or aCalendarInterval.t()
Returns
A
durationstruct orraises an exception
Notes
CalendarIntervalis defined by the most wonderful calendar_interval library.
Example
iex> Cldr.Calendar.Duration.new!(Date.range(~D[2019-01-01], ~D[2019-12-31]))
%Cldr.Calendar.Duration{
year: 0,
month: 11,
day: 30,
hour: 0,
microsecond: 0,
minute: 0,
second: 0
}
Specs
new!(from :: date_or_time_or_datetime(), to :: date_or_time_or_datetime()) :: t() | no_return()
Calculates the calendar difference between two dates
returning a Duration struct.
The difference calculated is in terms of years, months, days, hours, minutes, seconds and microseconds.
Arguments
fromis a date, time or datetime representing the start of the durationtois a date, time or datetime representing the end of the duration
Note that from must be before or at the same time
as to. In addition, both from and to must
be in the same calendar.
Returns
A
durationstruct orraises an exception
Example
iex> Cldr.Calendar.Duration.new!(~D[2019-01-01], ~D[2019-12-31])
%Cldr.Calendar.Duration{
year: 0,
month: 11,
day: 30,
hour: 0,
microsecond: 0,
minute: 0,
second: 0
}