ravi11o

ravi11o

Datex - A simple user friendly date and time library

Datex is a user friendly simple date and time library which I build while learning elixir and phoenix. It deals with standard date and time formats along with elixir formats. It has functions for comparing, adding and formatting dates and time from standard formats to elixir and vice-versa. It provides super friendly comparison results like 3 days ago or 2 months later in date and like an hour ago in time. It even has functions which provides a date-list in desired format from a dateRange.

I know its not perfect but I have tried my best and I am open to suggestions and feedbacks.

Thanks!

Most Liked

ravi11o

ravi11o

@Eiji I am aware of timex and in no way it could stand among Timex or any such date time library like calendar.
As I have already mentioned I created it while learning and thought of maybe it could help some in the community. I had no intention of flooding the forum.

Anyways, as far as I know Timex functions deal with Erlang datetime tuples, Date, NaiveDateTime, and DateTime. Datex is simply for date and time and it has no support for datetime or naive yet. Here you don’t have to worry about formats like dd-mm-yyyy or yyyy/mm/dd as you can parse any date format. For example…

> Datex.Date.format_date("2017/2/10", "MONTH_NAME_FULL DATE YYYY") 
"February 10, 2017"

OR

> Datex.Date.format_date(~D[2019-02-10], "DAY_SHORT, DATE MONTH_NAME_SHORT")
"Sun, 10 Feb"

I have also tried relative date and time comparison inspired from momentjs. Again you don’t have to worry about formats. For example…

> Datex.Date.compare("15 aug 2018", ~D[2018-08-06])
"a week and 2 days later"

> Datex.Time.compare(~T[23:16:45], "15:34:25")
"7 hours and 42 minutes later"

It also supports a lot of different formats to work with on date and time.

Eiji

Eiji

@ravi11o Did you know about timex? I did not looked deep into your library, but it’s what comes to me while reading your description. In such cases community would like to know why did you created such library (like solve problem in different way than current implementation does) and how different it’s from other implementations (for example compare it to already mentioned by me timex). It would be helpful if in your post you will add this information.

Where Next?

Popular in Libraries Top

Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
tompave
Hello there, I would like to share a feature toggles library (AKA feature flags) I’ve been working on. The main package is FunWithFlags...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 49522 488
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
josevalim
EDIT: since Ecto 3.0 final version is out, this post was amended to use the final versions in the instructions below. Hi everyone, We a...
New
mcrumm
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
wfgilman
I’ve cleaned up and open sourced three financial libraries I was using for my company. They are bindings for the APIs of these three comp...
New
benlime
LiveMotion enables high performance animations declared on the server and run on the client. As a follow up to my previous thread A libr...
New
MRdotB
I needed to reuse React components from my Chrome extension in my Phoenix/LiveView backend. I noticed that for Svelte/Vue, there are live...
New
Eiji
ExApi is a library that I’m developing now and hope release soon This library will allow to: list all apis list all api implementation...
New

Other popular topics Top

yurko
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
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
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
senggen
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
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 35421 110
New
New
polypush135
As many of you may have realized by now (sorry for all the posts here) I’ve been working on a db problem where I’m trying to aggregate a ...
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
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
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New

Sub Categories:

We're in Beta

About us Mission Statement