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 Announcing Top

Hal9000
Here is my first stab at this. README pasted below. https://github.com/Hal9000/elixir_random Comments and critiques are welcome. Thank...
New
zorbash
I created Kitto a framework for dashboards inspired by Dashing. The distributed characteristics of Elixir and the low memory footprint...
New
jakub-zawislak
Hi everyone, I’m coming from the Symfony (PHP) framework. I like Phoenix, but it has a one thing that was build much better in the Symfo...
New
tmbb
I’ve published the first version of my Makeup library. It’s a syntax highlighter for Elixir in the spirit of Pygments, Currently it highl...
New
handnot2
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application. This library uses Erlang esaml to provide plug enabl...
New
mathieuprog
Hello :waving_hand: Allow me to introduce you to Tz, an alternative time zone database support to Tzdata. Why another library? First a...
New
Flo0807
Hello everyone! I am excited to share our heart project Backpex with you. After building several Phoenix applications, we realized that...
New

Other popular topics Top

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
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
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
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 40165 209
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44778 311
New

We're in Beta

About us Mission Statement