This might be avoided in the Elixir codebase, not sure. But one clause of
the function could specifically check for :basic as the second argument.
So, the second argument is :basic or calendar.

def from_iso8601(date, format) when format in [:basic, :extended] do
  from_iso8601(date, format, Calendar.ISO)
end
def from_iso8601(date, calendar) do
  from_iso8601(date, :extended, calendar)
end

Allen Madsen
http://www.allenmadsen.com


On Tue, Aug 6, 2019 at 6:07 AM Wojtek Mach <[email protected]> wrote:

> I don't recall any examples at the moment but I remember seeing APIs that
> return data in the basic format so the proposal sounds good to me.
>
> I agree that the format should be specified explicitly. Given a
> Date.from_iso8601/2 already exists, the second argument is the calendar
> (Calendar.ISO by default), the format needs to be the 3rd argument which is
> a bit unfortunate.
>
> --
> You received this message because you are subscribed to the Google Groups
> "elixir-lang-core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/elixir-lang-core/59A9C014-4CD5-40FB-AF33-9CC7C259E691%40wojtekmach.pl
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/CAK-y3Cs1W8GpSiKPOPh9pr2dwMOYw%2BsoMvRz7Usw71q7RX_DzA%40mail.gmail.com.

Reply via email to