4 ms·
So far, I've been totally unimpressed with Date/Time support in Elixir. `DateTime` wasn't even part of the API until 1.9.0!
by dudul 7y ago
So far, I've been totally unimpressed with Date/Time support in Elixir. `DateTime` wasn't even part of the API until 1.9.0!
- andy_ppp 7y agoThat's why most people use a third party library. For me it's fine for most things, what were you doing? An example of such a library I've used is https://github.com/bitwalker/timex https://github.com/bitwalker/timex which seems quite complete.
- conradfr 7y agoTimex is great. However sometimes I feel I only use it because of the weird default (non-)handling of timezones by DateTime.
- mcmatterson 7y agoAs someone who writes Elixir full-time in a product with deeply complex date / time needs (spanning multiple timezones, sources of time, multiple meanings of 'month', etc), I can say with some conviction that the the simplicity of Elixir's DateTime module is most definitely a feature. The lack of something as transparent in Rails was / is a huge part of what makes our team so productive since porting the product to Elixir; NaiveDateTime alone has saved us from more bugs than I care to think about. Between Elixir core and Timex, they've definitely solved the harder corners of time as well as any other library or platform I've seen.
- bitscrapper 7y agoFWIW, timezone handling was added in v1.8 or v1.9. At this point I think Elixir has ported all features from Timex, except date parsing and date formatting.
- conradfr 7y agoTo be fair that's two big usecases for datetimes in any software ;)
- dugmartin 7y agoI built an event ticketing site a couple of years ago in Elixir/Phoenix and it has been rock solid since the initial release. The only painful thing during development was datetime storage and math - I used a third party library (I’m not at my development machine so I don’t know which one it was).
- losvedir 7y agoI'm actually really happy with it now. At work we used Timex for all the datetime/timezone stuff because, as you say, it wasn't available in earlier versions of Elixir. However, since 1.9 it's quite good, IMO. I ripped out Timex from most of the code because it's a beast of a library and not especially well documented, relying on just TzData for the TimeZone database. It's great to rely on just the standard library again because it's up to Elixir's usual standards of documentation and stability.
- out_of_protocol 7y agoDateTime is added in 1.3.0: https://hexdocs.pm/elixir/1.3.0/DateTime.html https://hexdocs.pm/elixir/1.3.0/DateTime.html