choptastic / qdate

Erlang date, time, and timezone management: formatting, conversion, and date arithmetic
http://sigma-star.com/blog/post/qdate
MIT License
247 stars 82 forks source link

Add atom `retain` as a possible value for ToTimezone #28

Open lukyanov opened 7 years ago

lukyanov commented 7 years ago

This will keep the original timezone from the input date.

choptastic commented 7 years ago

Yuri, you are the hero our world needs!

With the holidays in full swing, I probably won't have a chance to look this over until after the weekend, but on a quick glance, this looks good.

Thanks so much!

lukyanov commented 7 years ago

Well, I found a bug here... to_string("T", retain, "2016:12:26 01:00+03:00")) won't work (fails with an exception). I'm not quite sure how to deal with this... The problem here is that we cannot "retain" the timezone "+03:00" as for this we would need a literal name of the timezone ("MSK"), but there is no way to convert it... It's not even valid to do such a conversion...

What are your thoughts on this?

choptastic commented 7 years ago

Sorry for the delay. Good catch on the bug. I'd think it'd probably be worth converting hard-offset timezones (like +0500 or GMT-10) to the offset name like "GMT+5" or "GMT-10".

Seems like the safest solution. Whaddya think?

choptastic commented 7 years ago

Does my suggestion seem reasonable to you, and if so, would you have time to try to implement it?

lukyanov commented 7 years ago

Yes, it seems reasonable. I'll try. Sorry for the delay, long holidays in Russia :)

choptastic commented 7 years ago

That's quite alright! No rush. Take the time with your family!

On Jan 7, 2017 11:07 AM, "Yuri Lukyanov" notifications@github.com wrote:

Yes, it seems reasonable. I'll try. Sorry for the delay, long holidays in Russia :)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/choptastic/qdate/pull/28#issuecomment-271095965, or mute the thread https://github.com/notifications/unsubscribe-auth/AALYnNPcVdy3DNPIHfZTonkveO7iBH94ks5rP8ZpgaJpZM4LUD7G .

choptastic commented 1 year ago

Hi @lukyanov!

Just bouncing in here to see if this is something you still had plans on implementing. I know it has been a few years, so if that's not in the plan anymore, I can finish it off.