cdegroot

cdegroot

Should Calendar types and timezones be part of Elixir standard library?

What’s the reason to include this in core? One of the things I like about Elixir’s standard library is its small surface area. It keeps it nimble, simple to understand, and usually I use pretty much all of it in any project.

That will not hold up for the endless headache that human calendar systemsand timezones represent. Very often, I don’t need it (and even if I do, I don’t want it but that’s a different topic :wink: ). There are excellent libraries out there for when people do need it, but given that that is often not the case (I just went through our projects and the vast majority doesn’t pull in timex) it’s fine to have it in a library.

Personally, I put timezones (and all the other calendaring support) in the same bucket as money types, currencies, fixed decimal calculations, matrices, etcetera: very useful to have libraries for, but given the relatively limited scope, I would not add it to the core.

(Please, please, please don’t make the mistake of defining the success of Elixir by an ever expanding scope and larger codebase :wink: )

Most Liked

josevalim

josevalim

Creator of Elixir

One of the articles in there was written by @Lau, which maintains the calendar library and participated in the design of the Calendar types in Elixir.

Calendar types are already part of Elixir. The reason that most of your projects most likely don’t pull in timex is exactly because of those types. Before we had builtin support for those, most projects resorted to either passing tuples around, such as {{year, month, day}, {hour, minute, second}}, or we created ad-hoc types.

This is not a discussion if we should add Calendar types or a timezone contract to Elixir. This discussion happened 2 years ago. This is about the best way to finish the last bit.

dimitarvp

dimitarvp

If I read this correctly, the core team wants good standardized contracts for dealing with times, dates and timezones. What would only change is that libraries like timex, calendar and ecto will be modified to implement behaviours which will be defined in the Elixir stdlib itself; they will still be separate libraries, only they will all implement the now standardized contracts. The implementation freedom – and pluggability – remains.

Where Next?

Popular in Discussions Top

arcanemachine
https://nitter.net/josevalim/status/1744395345872683471 https://twitter.com/josevalim/status/1744395345872683471
New
PragTob
Hello everyone, I know we had quite some threads (read through lots of them) about background job processing but it remains a hotly deba...
New
Jayshua
I recently came across the javascript library htmx. It reminded me a lot of liveview so I thought the community here might be interested....
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New
Fl4m3Ph03n1x
Background This question comes mainly from my ignorance. Today is Black Friday, one of my favorite days of the year to buy books. One boo...
New
marciol
Please, let me know if this kind of discussion already took place in another topic . Hi all, how do you consider if is better to build ...
New
shishini
I think this twitter post and youtube video didn’t get as much attention as I hoped I am still new to Elixir, so can’t really judge ...
New
hazardfn
I suppose this question is effectively hackney vs. ibrowse but we are at a point in our project where we have to make a choice between th...
New
Qqwy
Looking at the stacks that existing large companies have used, WhatsApp internally uses Mnesia to store the messages, while Discord uses ...
New
AstonJ
It’s been a while since we’ve had a thread like this, so what better way to kick off the year with :003: What does being an Elixir user ...
New

Other popular topics Top

New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 43757 214
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
Qqwy
Original source of discussion: This topic on the Pragmatic Programmers’ Functional Web Development with Elixir, OTP, and Phoenix forum. ...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54120 245
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
svb
Hi! Currently I want to submit a form by pressing the Enter key. However, since my input field is of type “textarea” this is just adds a...
New

We're in Beta

About us Mission Statement