That works great for me.  The next step in this process for me is always 
convert-to-UTC anyway, and it seems like the return value gives enough 
information for someone with a different use case to piece together a 
makeshift timezone from the UTC offset if they need to.  Seems like a good 
solution.

Thanks for the quick response, and I look forward to the 1.4.0 release!

On Monday, November 28, 2016 at 3:20:29 PM UTC-8, José Valim wrote:
>
> We have added DateTime.from_iso8601 that can parse a ISO8601 as long as it 
> has an offset. It will convert the datetime to UTC (a valid timezone) and 
> also return the parsed offset.
>
>
>
> *José Valim*
> www.plataformatec.com.br
> Skype: jv.ptec
> Founder and Director of R&D
>
> On Mon, Nov 28, 2016 at 10:39 PM, José Valim <
> [email protected] <javascript:>> wrote:
>
>> To think about it in another way, you lose the information when you do
>>> `DateTime.to_iso8601`, not in `DateTime.from_iso8601`.  If anything,
>>> it seems like `DateTime.to_iso8601` should be the controversial,
>>> disclaimered transformation because this is the lossy point where
>>> information about the specific locale is lost.
>>>
>>
>>
>> The issue is that DateTime.from_iso8601 does not contain enough 
>> information to build a DateTime in the first place. The time_zone field is 
>> not currently allowed to be nil (solution 1) and Etc/GMT+X does not support 
>> all offsets, such as 5.5h, which is a valid offset (solution 2).
>>
>> So I agree that DateTime.to_iso8601 is controversial (and we have 
>> warnings on its documentation) but at the moment DateTime.from_iso8601 is 
>> not possible. I believe it would only be possible if we convert it to UTC 
>> but I am not sure if it is a valid trade-off in our case.
>>
>>
>

-- 
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/6d2cbe95-6dae-4347-a66a-4e031cfa2c65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to