Cldr Calendars version 2.0.0
Breaking Changes
-
Date.day_of_week/2will now return an ordinal day of week for allex_cldr_calendar-based calendars. Previously the result was a cardinal day of week which meant that the results fromDate.beginning_of_week/2andDate.end_of_week/2were returning incorrect results. This outcome is the result of a lengthy discussion about whether the result should be cardinal or ordinal. The consequences are that the day of week is now1meaning "first day of the week". It specifically does not mean1denotes "Monday". -
MyApp.Cldr.Calendar.strftime_options/1now expects a keyword list of options only. Previously the first optional argument was a locale and the second optional argument was a keyword list. This simplifies specifying a calendar or a locale or both. -
Cldr.Calendar.validate_calendar/1will now return{:ok, Cldr.Calendar.Gregorian}rather than an error if the argument isCalendar.ISO. This makes it easier for calendar code to work with standard dates and times in a localized context.
Bug Fixes
-
Fixes
Date.beginning_of_week/2andDate.end_of_week/2- related to the breaking change in results returned byDate.day_of_week/2forex_cldr_calendar-based calendars. -
Fix
Cldr.Calendar.strftime_options!/0to return the correct values for day of the week in alignment with the breaking change above. -
Fix
Cldr.Calendar.localize/3for:day_of_week,:days_of_weekand:monthwhen the calendar doesn't start its week on Monday or doesn't start its year in January.
Enhancements
-
Adds
Cldr.Calendar.iso_day_of_week/1to return a day of week that is defined as1is "Monday" and7is "Sunday". Any application code which fails now due to the breaking change should be able to replace calls toDate.day_of_week/1with calls toCldr.Calendar.iso_day_of_week/1. -
Adds
Cldr.Calendar.strftime/3that is a localized wrapper aroundCalendar.strftime/3.