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.
@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.
@Eiji I am aware of timex and in no way it could stand among
Timex or any such date time library like
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,
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
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"
> 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.