Skip to content

Instantly share code, notes, and snippets.

@yasserhussain1110
Created April 19, 2017 17:46
Show Gist options
  • Save yasserhussain1110/b8e53033f035dddacd6fe43a2fec7632 to your computer and use it in GitHub Desktop.
Save yasserhussain1110/b8e53033f035dddacd6fe43a2fec7632 to your computer and use it in GitHub Desktop.
def parse_natural(input) do
with {:error, _} <- Timex.parse(input, "{Mfull} {D}, {YYYY}"),
{:error, _} <- Timex.parse(input, "{Mfull} {D} {YYYY}") do
{:error, "Failed to parse date"}
else
{:ok, date_time} -> {:ok, date_time}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment