cenotaph

cenotaph

Sorry trex, we can't handle your insurance claim

Just having fun with Elixir and seeing this method.

:thinking: thinking would months in a year ever change.. but then seeing the error playing around :slight_smile:

iex(1)> Calendar.ISO.months_in_year(1)
12
iex(2)> Calendar.ISO.months_in_year(99)
12
iex(3)> Calendar.ISO.months_in_year(3939848447)
** (FunctionClauseError) no function clause matching in Calendar.ISO.months_in_year/1

    The following arguments were given to Calendar.ISO.months_in_year/1:

        # 1
        3939848447

    Attempted function clauses (showing 1 out of 1):

        def months_in_year(year) when is_integer(year) and (year >= -9999 and year <= 9999)

    (elixir 1.11.3) lib/calendar/iso.ex:601: Calendar.ISO.months_in_year/1

Most Liked

NobbZ

NobbZ

This is as sepcified in ISO 8601. Extended years with more than 4 digits are not mandatory and require prior agreement with sender and receiver of the date.

In theory implementing an own Calendar.ExtendedISO which supports years with more than 4 digits should be possible and would fullfil the “prior agreement” part.

al2o3cr

al2o3cr

TBH, tracking anything with exact date-stamps prior to the twentieth century is a bit of a minefield - the calendar in ISO8601 started being adopted in 1583 but took a looooooooong time (and a lot of politics / religion played out with swords and muskets) to be consistently adopted:

Where Next?

Popular in Chit Chat Top

cenotaph
Just having fun with Elixir and seeing this method. :thinking: thinking would months in a year ever change.. but then seeing the error p...
New
Null-logic-0
Hello everyone, I’m currently reading Elixir in Action (3rd Edition), and I’d like some advice on how to deepen my understanding of OTP ...
New
CodeSync
Hey everyone! The biggest event of the year for our community is fast approaching—ElixirConf US 2026! Whether you’ve been writing Elixir...
New

Other popular topics Top

KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36352 110
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39467 209
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

Latest on Elixir Forum

We're in Beta

About us Mission Statement