timex v2.1.0 Release Notes
-
โ Added
- Two new protocols,
Timex.Comparable
andTimex.Convertable
, implementing these two for your own date/time types will allow you to use the Timex API with your own types, just be aware that only Dates, DateTimes, or AmbiguousDateTimes will be returned as date/time representations, but it should be trivial to add a function in your implementation to convert back. - ๐ Basic Julian calendar implementation, which allows you to get the Julian date for a given Convertable, see
Timex.to_julian/1
, you can also get the day of the week number for a Julian date, viaTimex.Calendar.Julian
to_julian
function to theTimex.Convertable
protocolTimex.timezones
to get a list of all valid timezones ### ๐ Changed- POTENTIALLY BREAKING The
{Zname}
format token was formatting with the abbreviation, which is incorrect. It has been changed to format with the full name, use{Zabbr}
if you want the abbreviation. - ๐ Moved comparison and diffing behaviour into a new protocol,
Timex.Comparable
, which allows you to now provide your own implementations for comparing other date or datetime types against Timex ones. This makes the API more flexible, and also cleaned up the code quite a bit. - Modified Timex API to accept Comparables for just about all functions
- โ Added implementations of
Timex.Comparable
forTuple
,Date
,DateTime
,AmbiguousDateTime
- โ Added implementations of
Timex.Convertable
forMap
andAtom
. The former will accept any map with either DateTime-like keys (i.e. year/month/day/hour/minute/etc.) as strings or atoms, or any Date-like keys (year/month/day), as strings or atoms. The latter will accept only two atoms which represent Dates/DateTimes right now, :epoch, and :zero. - Modified
Timex.Comparable
to take anyTimex.Convertable
- Two new protocols,