What's the harm in just supporting the basic format? I mean, it's in the
spec.

On Fri, Aug 16, 2019 at 8:52 AM Stefan Chrobot <[email protected]> wrote:

> We could use format as the second argument and make it
> backwards-compatible using Allen's idea, but it requires at least 4 heads:
>
>   def from_iso8601(date) do
>     # :extended + Calendar.ISO
>   end
>
>   def from_iso8601(date, format) when format in [:basic, :extended] do
>     # format + Calendar.ISO
>   end
>
>   def from_iso8601(date, calendar) do
>     # :extended + calendar
>   end
>
>   def from_iso8601(date, format, calendar) do
>     # format + calendar
>   end
>
> What do you think? Is it worth it?
>
> Best,
>
> Stefan
>
> wt., 6 sie 2019 o 14:39 Allen Madsen <[email protected]>
> napisał(a):
>
>> 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
>> <https://groups.google.com/d/msgid/elixir-lang-core/CAK-y3Cs1W8GpSiKPOPh9pr2dwMOYw%2BsoMvRz7Usw71q7RX_DzA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
> --
> 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/CACzMe7YV-Op6QmS__mmLDf9KQ6HqPSou4AynrMsYKQfnn4JeNQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/elixir-lang-core/CACzMe7YV-Op6QmS__mmLDf9KQ6HqPSou4AynrMsYKQfnn4JeNQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAKwTqEkcMFsqUtd%2B-9XFh6%2BuKu%2Bcr44_TYPNU8-9MqytU%2B3MeA%40mail.gmail.com.

Reply via email to