Kday

Build statusHex.pmHex.pmHex.pmHex.pm

Introduction

kday provides functions to return the date of the first, last or nth day of the week on, nearest, before or after a given date.

Kday Installation

Add kday to your deps in mix.exs.

def deps do
  [
    {:kday, "~> 1.0"}
    ...
  ]
end

Functions

Examples

Days of the week follow the elixir convention of 1 being Monday and 7 being Sunday.

# Memorial Day in the US
iex> Kday.last_kday(~D[2017-05-31], 1)
~D[2017-05-29]

iex> Kday.kday_nearest(~D[2016-02-29], 2)
~D[2016-03-01]

iex> Kday.kday_on_or_after(~D[2017-11-30], 1)
~D[2017-12-04]