View Source Machete.DateMatcher (Machete v0.3.0)
Defines a matcher that matches Date values
Summary
Types
Describes the arguments that can be passed to this matcher
Describes an instance of this matcher
Functions
Matches against Date values
Types
Functions
Matches against Date values
Takes the following arguments:
exactly
: Requires the matched Date to be exactly equal to the specified Date. The atom:today
can be used to use today as the specified Dateroughly
: Requires the matched Date to be within +/- 1 day of the specified Date. The atom:today
can be used to use today as the specified Datebefore
: Requires the matched Date to be before or equal to the specified Date. The atom:today
can be used to use today as the specified Dateafter
: Requires the matched Date to be after or equal to the specified Date. The atom:today
can be used to use today as the specified Date
Examples:
iex> assert Date.utc_today() ~> date()
true
iex> assert Date.utc_today() ~> date(exactly: :today)
true
iex> assert ~D[2020-01-01] ~> date(exactly: ~D[2020-01-01])
true
iex> assert Date.utc_today() ~> date(roughly: :today)
true
iex> assert ~D[2020-01-01] ~> date(roughly: ~D[2020-01-02])
true
iex> assert ~D[2020-01-01] ~> date(before: :today)
true
iex> assert ~D[2020-01-01] ~> date(before: ~D[3000-01-01])
true
iex> assert ~D[3000-01-01] ~> date(after: :today)
true
iex> assert ~D[3000-01-01] ~> date(after: ~D[2020-01-01])
true