svilen
Author of Concurrent Data Processing in Elixir
Month - library focused on working with months, rather than Date/DateTime
At Heresy we have a lot of date logic around months and quarters and forecasting horizons. We started using Elixir’s Date module, naturally, but ended with a lot of functions that deal with the necessary day field of the Date struct.
We wanted to simplify our code a bit and ended up extracting some of that code into month, which now could be found in the usual places:
- https://hex.pm/packages/month
- https://hexdocs.pm/month/Month.html
- https://github.com/heresydev/month
Here’s a sample:
iex> import Month.Sigils
Month.Sigils
iex> Month.utc_now!()
~M[2019-03]
iex> range = Month.Range.new!(~M[2019-01], ~M[2019-03])
#Month.Range<~M[2019-01], ~M[2019-03]>
iex> range.months
[~M[2019-01], ~M[2019-02], ~M[2019-03]]
iex> Month.Period.shift(range, 3)
#Month.Range<~M[2019-04], ~M[2019-06]>
Everything is built on top of Date so no extra dependencies.
It’s a very specific use case perhaps, but hopefully someone would find it useful! 
Most Liked
wojtekmach
Hex Core Team
Nice!
Shameless plug, I’ve run into a similar problem and created https://github.com/wojtekmach/calendar_interval which is a little bit more generic:
iex> CalendarInterval.utc_now(:month)
~I"2019-03"
iex> Enum.to_list(~I"2019-01/03")
[~I"2019-01", ~I"2019-02", ~I"2019-03"]
3
Popular in Libraries
Presenting Aviacommerce, open source e-commerce platform in Elixir
Aviacommerce is an open source e-commerce platform in Elixir. We at...
New
If you would like to migrate away from node/npm/webpack while still using sass, the dart_sass package provides a installer and runner for...
New
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library.
The progre...
New
I created a new library GitHub - benvp/ex_cva: Class Variance Authority for Elixir which aims to make it very easy to define different va...
New
Solution is a library to help you with working with ok/error-tuples in case and with-expressions by exposing special matching macros, as ...
New
I created Kitto a framework for dashboards inspired by Dashing.
[demo]
The distributed characteristics of Elixir and the low memory foo...
New
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
Hey everyone,
I just released WebSockex which is a Elixir WebSocket client.
WebSockex strives to work as a OTP special process, be RFC6...
New
For a good number of months I've been working on creating a very basic RTMP live video streaming server. Now that I have a very, very ba...
New
Hello all,
I have been working on my proposed project called Tensorflex as part of Google Summer of Code 2018.. Tensorflex can be used f...
New
Other popular topics
Phoenix 1.4.0 released
Phoenix 1.4 is out! This release ships with exciting new features, most notably
with HTTP2 support, improved deve...
New
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
I would like to know that is there any online source for learning Phoenix Framework for building E-Commerce Store? Any advantage on build...
New
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service.
Currently when I de...
New
What is most correct way to open, read and parse JSON file with poison?
For example if we have example.json file in root of some projec...
New
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible.
total = 10
while total != 0
...
New
I tried installing
elixir 1.11.2
erlang 23.3.4
via asdf in my zsh shell. Enabled the versions locally and globally.
When I list them ...
New
After calling mix ecto.create I get this error:
17:00:32.162 [error] GenServer #PID<0.412.0> terminating
** (Postgrex.Error) FATAL...
New
by Lance Halvorsen
Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
New







