Skip to content

Instantly share code, notes, and snippets.

@Jeweller-Tsai
Last active August 6, 2016 04:06
Show Gist options
  • Save Jeweller-Tsai/7e79522d7d22c38ebd3c4fcf9462a49b to your computer and use it in GitHub Desktop.
Save Jeweller-Tsai/7e79522d7d22c38ebd3c4fcf9462a49b to your computer and use it in GitHub Desktop.
def july do
1..31
|> Enum.map(fn i ->
{:ok, d} = Date.new 2016, 7, i
d
end)
|> Enum.filter(fn d ->
!weekend?(d)
end)
end
def weekend? date do
weekday = date |> Date.to_erl |> :calendar.day_of_the_week
weekday > 5
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment