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 GitHub - wojtekmach/calendar_interval: Functions for working with calendar intervals · GitHub 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 Announcing
In short
Plug n’ play OAuth 2.0 provider library. Just set up a resource owner schema with Ecto (your user schema), install the dependen...
New
Hey there!
I wrote a download elixir package which does exactly what its name about - an easy way to download files.
I saw solutions ab...
New
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
Hi!
I wanted to introduce my latest project LiveSvelte. It allows you to render Svelte inside LiveView with end-to-end reactivity. It’s ...
New
The best overview for how things are tied together is this presentation. Modules and functions are pretty well documented at this point, ...
New
simple_feature_flags is a tiny package that lets you turn features on or off based on which environment (e.g. localhost, staging, product...
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
Hey everyone :waving_hand:
Excited to join this forum - I am one of the founders and current project maintainers of a popular and open-s...
New
Hey all,
We have made an Ecto3 Adapter for SQLite3, ecto_sqlite3!
We have successfully on-boarded the full suite of integration tests (...
New
Hi! :waving_hand:
I would like to present LiveSelect, a little library that I wrote to easily add a dynamic selection input to your LV f...
New
Other popular topics
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch.
This project took far...
New
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1]
15:22:35.803 [error] gen_event {lager_file_backend...
New
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
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
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
New
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
New
What learn first? Rust or Elixir
Hi Elixir community!
I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance








