mudasobwa

mudasobwa

Creator of Cure

`Tempus`, the library to handle time slots

Tempus has become more than just plain time slot management. The best example would be managing a schedule for the dentist (check if the slot is available, or joint, or when the next available slot of the given duration is available, etc.)

It allows one to manage time slots effortlessly. The mathematical background of the implementation reveals that under the hood it has an Enumerable which implements a protocol. Two default implementations backed by List and Stream are included.

Adding a slot to an instance of Tempus.Slots automagically merges it if applicable. List implementation (which is the most suitable for short slot series) might be merged into the Stream implementation.

From the outmost world, the usage is as easy as Tempus.free?(slots, origin) or like. Slots obviously implement Collectable protocol and other goodness.


This version comes with a lot of guards that might be used when dealing with datetimes, not only slots.

Comments and criticism are highly appreciated. We have used this library in production to handle weekends/holidays in different countries (which are declared as an infinite stream) for a couple of years already.

Most Liked

mudasobwa

mudasobwa

Creator of Cure

Effective today, Tempus supports different calendars.

It’s still very much WIP and there are tweaks and quirks required in config to make it work with a different calendar (because is_coming_before/2 is essentially a macro which is allowed in guards,) but I have tested it and I can claim it’s fully functional even with datetimes given in different calendars, let alone different timezones.

Enjoy.

Where Next?

Popular in Libraries Top

mhanberg
I just released the first version of Temple: an HTML DSL for Elixir and Phoenix! You can read this blog post or the docs for more info...
New
marcuslankenau
I feel kind of stuck with the absence of a proper xml library for Elixir. Currently I use SweetXML which was ok for me more or less to pa...
New
seancribbs
Today I released a new dialyzer Mix task as the dialyzex package! At the time we started writing this task, the existing dialyzer integra...
New
arkgil
Hi all! I’m happy to announce that Telemetry v0.3.0 is out! This release marks the conversion from Elixir to Erlang so that all the libr...
New
benlime
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
Crowdhailer
Experimenting with this code. OK.try do user <- fetch_user(1) cart <- fetch_cart(1) order = checkout(cart, user) save_or...
New
bryanjos
Hi, I just published version 0.23.0 of Elixirscript. Most of the changes are around JavaScript interop now that Elixirscript uses the ...
New
bryanjos
Hi, I wanted share a small library we at Revelry Labs made for rendering react components from the server side. There are instructions fo...
New
vic
Expat is a tiny experiment I did for extracting patterns and being able to reuse them (compose and share patterns between elixir librarie...
New
bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
381 12391 119
New

Other popular topics Top

shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
danschultzer
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...
548 27727 240
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
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
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New

Sub Categories:

We're in Beta

About us Mission Statement