Changelog
View SourceNote that ex_cldr_calendars version 1.24.0 and later are supported on Elixir 1.12 and later only.
Cldr.Calendars v2.3.1
This is the changelog for Cldr Calendars v2.3.1 released on September 10th, 2025. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fixes stray doc backtick. Thanks to @Munksgaard. Closes #29.
Cldr.Calendars v2.3.0
This is the changelog for Cldr Calendars v2.3.0 released on June 8th, 2025. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix
Cldr.Calendar.localize/3for the type of:monthwhen the provided date has only the month and not the year. In these cases the year will default to the current year. Thanks to @Munksgaard. Closes #28.
Enhancements
- Adds
Cldr.Calendar.month_names/2to return the names of months for a given calendar. Note that the list of months may include month names that are only valid in some years. Thanks to @Munksgaard for the issue. Closes #28. One example:iex> Cldr.Calendar.month_names(Calendar.ISO, format: :wide) %{ 1 => "January", 2 => "February", 3 => "March", 4 => "April", 5 => "May", 6 => "June", 7 => "July", 8 => "August", 9 => "September", 10 => "October", 11 => "November", 12 => "December" }
Cldr.Calendars v2.2.0
This is the changelog for Cldr Calendars v2.2.0 released on March 26th, 2025. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Support Elixir 1.19 and OTP 28 without errors or warnings. Primarily this relates to changes to OTP's new :re module and Elixir's evolving type system.
Cldr.Calendars v2.1.1
This is the changelog for Cldr Calendars v2.1.1 released on March 19th, 2025. For older changelogs please consult the release tag on GitHub
Bug Fixes
Fix
Cldr.Calendar.localize/2for calendars that aren't derived fromCldr.Calendar.Gregorian. For exampleCldr.Calendar.Ethiopian,Cldr.Calendar.Coptic,Cldr.Calendar.Julianand the lunisolar calendars.Add
Cldr.Calendar.Julian.plus/6for:year.
Cldr.Calendars v2.1.0
This is the changelog for Cldr Calendars v2.1.0 released on March 18th, 2025. For older changelogs please consult the release tag on GitHub
Enhancements
Update to CLDR 47 data.
Documents the
:am_pmoption toCldr.Calendar.localize/2and toCldr.Calendar.strftime_options!/2. This option, when set to:variant, uses the variant data for "am" and "pm".
Cldr.Calendars v2.0.0
This is the changelog for Cldr Calendars v2.0.0 released on January 31st, 2025. For older changelogs please consult the release tag on GitHub
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.
Cldr.Calendars v1.27.0
This is the changelog for Cldr Calendars v1.27.0 released on January 7th, 2025. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Allow locale parameter to be a binary or atom for
calendar_from_locale/2,min_days_for_locale/2andfirst_day_for_locale/2.
Enhancements
A locale with a
-u-fw-mon(first day of week is a Monday) but no calendar specified will returnCldr.Calendar.Gregorian. This is spec compliant and is useful to override the "first day of week". For example,endefines a calendar that starts on Sunday. If it is desired to us a week that starts on a Monday, useen-u-fw-mon.Similarly, a locale with
-u-fw-<day>will generate and return a calendar that has its first day of week as that day.
Cldr.Calendars v1.26.4
This is the changelog for Cldr Calendars v1.26.4 released on December 29th, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
Fix day of week calculations when the config
%{day_of_week: :first}is set.Improve the implementation of the fix for #23 to respect the conditional compilation based upon whether
ex_cldr_unitsis configured or not.
Cldr.Calendars v1.26.3
This is the changelog for Cldr Calendars v1.26.3 released on December 29th, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix typing warning on Elixir 1.18. Thanks to @tjchambers for the report. Closes #23.
Cldr.Calendars v1.26.2
This is the changelog for Cldr Calendars v1.26.2 released on September 12th, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix
Cldr.Calendar.Interval.compare/2when the ranges overlap by one day. Thanks to @ArthurClemens for the report. Fixes #22.
Cldr.Calendars v1.26.1
This is the changelog for Cldr Calendars v1.26.1 released on August 16th, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix specs to suport dialyzer flags
:error_handling, :unknown, :underspecs, :extra_return, :missing_return
Cldr.Calendars v1.26.0
This is the changelog for Cldr Calendars v1.26.0 released on July 27th, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Microseconds in
Cldr.Calendar.Duration.t/0now follow theTime.t/0expectations.
Enhancements
Cldr.Calendars v1.25.2
This is the changelog for Cldr Calendars v1.25.2 released on July 9th, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix spec for
Cldr.Calendar.localize/{1,2,3}again - the return type was being aliased and hence dialyzer was unhappy. Not always, just sometimes.
Cldr.Calendars v1.25.1
This is the changelog for Cldr Calendars v1.25.1 released on July 7th, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix spec for
Cldr.Calendar.localize/{1,2,3}to use the more expansive date/time/datetime types fromCldr.Calendar.
Cldr.Calendars v1.25.0
This is the changelog for Cldr Calendars v1.25.0 released on July 7th, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix
Cldr.Calendar.Preference.calendar_from_locale/1when-u-ca-<calendar>is specified as part of the locale.
Enhancements
This release provides initial support for partial dates. Partial dates are those that do not have all of the fields
:year,:month,:dayand:calendar. Not all functions require all parts of a date. And in some cases, like formatting just the year and the month, it shouldn't be necessary to provide data that has no use. Of course many functions do require all fields be present - like adding a number of days to a date. In these cases, missing fields will cause an error to be returned.ex_cldr_dates_timesversion 2.19.0 and later take advantage of partial dates when formatting.Support
Cldr.Calendar.localize/3optionera: :variantto return an alternative localization. For instance, in the:enlocale, this will returnCEandBCErather than the defaultADandBC.Add
MyApp.Cldr.Calendar.localize/3that delegates toCldr.Calendar.localize/3.
Cldr.Calendars v1.24.2
This is the changelog for Cldr Calendars v1.24.2 released on June 22nd, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix runtime warning about
map.fieldnotation without parens when calling a function on Elixir 1.17.
Cldr.Calendars v1.24.1
This is the changelog for Cldr Calendars v1.24.1 released on June 21st, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Compile on Elixir releases < 1.17. Some code in
Cldr.Calendardepends on the newDuration.t/0struct which is only available on Elixir 1.17 or later. Elixir 1.16 is now added to the CI test matrix to ensure no future regression. Thanks to @WernerBuchert for the report. Closes #21.
Cldr.Calendars v1.24.0
This is the changelog for Cldr Calendars v1.24.0 released on June 21st, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix compiler warnings for Elixir 1.17.
Enhancements
- Adds new calendar callbacks
Calendar.shift_date/4,Calendar.shift_time/5andCalendar.shift_naive_datetime/8supported in Elixir 1.17.
Cldr.Calendars v1.23.1
This is the changelog for Cldr Calendars v1.23.1 released on March 1st, 2024. For older changelogs please consult the release tag on GitHub
Bug Fixes
Cldr.Calendar.plus/4consistently applies a default for the:coerceoption toCldr.Calendar.plus/4andCldr.Calendar.minus/4. The default istrue. Previously the default for plus/minus months wastruebut the default for years wasfalse. Thanks to @linusdm for raising the issue.Fix specs for
Cldr.Calendar.localize/{1..3}. Thanks to @alappe for raising the issue. Closes #15.
Cldr.Calendars v1.23.0
This is the changelog for Cldr Calendars v1.23.0 released on December 16th, 2023. For older changelogs please consult the release tag on GitHub
Note that ex_cldr_calendars version 1.21.1 and later are supported on Elixir 1.11 and later only.
Breaking Change
Cldr.Calendar.weeks_in_year/1now returns a tuple of the form{weeks_in_year, days_in_last_week}instead of an integer value. In particular for Gregorian based calendars, the value ofweeks_in_yearwill be 53 and the value ofdays_last_weekwill be either1or2depending on whether it is a leap year or not.
Enhancements
Adds
:weekand:dayto the options for<calendar>.plus/5. These are in addition to the already existing:year,:quarterand:monthoptions. This addition is primarily to support tempo. This enhancement has no affect on the public API in theCldr.Calendarmodule. The bump in minor release number is to allow fortempoto target the appropriate version in a semver compatible manner.Adds
Cldr.Calendar.ISOwhich is a month-based calendar with weeks that start on Monday and the first week must have at least 4 days of the current year in it. This aligns to the ISO8601 standard and is the month-based counterpart to the week-basedCldr.Calendar.ISOWeekcalendar already included inex_cldr_calendars.
Cldr.Calendars v1.22.1
This is the changelog for Cldr Calendars v1.22.1 released on July 4th 2023. For older changelogs please consult the release tag on GitHub
Note that ex_cldr_calendars version 1.21.1 and later are supported on Elixir 1.11 and later only.
Bug Fixes
- Compatibility with the
Calendarbehaviour changes in Elixir 1.15.
Cldr.Calendars v1.22.0
This is the changelog for Cldr Calendars v1.22.0 released on April 28th 2023. For older changelogs please consult the release tag on GitHub
Note that ex_cldr_calendars version 1.21.1 and later are supported on Elixir 1.11 and later only.
Bug Fixes
- Fixes localization of leap months which are used in lunisolar calendars.
Enhancements
Updates to ex_cldr version 2.37.0 which includes data from CLDR release 43
Supports configuring the
:cldr_calendar_namefor a calendar that is defined with theCldr.Calendar.Base.{Month, Week}macros. The options can be:gregorian(the default) or:japanese. This change supports the newex_cldr_calendars_japaneselibrary.
Cldr Calendars v1.21.0
This is the changelog for Cldr Calendars v1.21.0 released on October 24th, 2022. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds modified Julian days conversions. Thanks to @polvalente for the PR. Closes #14.
Cldr Calendars v1.20.0
This is the changelog for Cldr Calendars v1.20.0 released on September 21st, 2022. For older changelogs please consult the release tag on GitHub
Enhancements
Doctests now reflect the new expression based inspection outputs in Elixir 1.14 for
t:Date.Range.t()Improve the documentation for periods. Thanks to @alappe for the pull requests.
Add
Cldr.Calendar.date_from_list/2that takes a keyword list of time units and returns aDate.t/0Add
Cldr.Calendar.date_from_day_of_year/3that returns aDate.t/0for the ordinal day of the year.
Cldr Calendars v1.19.0
This is the changelog for Cldr Calendars v1.19.0 released on June 9th, 2022. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds
Cldr.Calendar.localize/{1,2}that converts a date into the calendar associated with the provided locale.
Cldr Calendars v1.18.1
This is the changelog for Cldr Calendars v1.18.1 released on June 5th, 2022. For older changelogs please consult the release tag on GitHub
Bug Fixes
MyApp.Cldr.Calendar.calendar_from_locale/1was added to the backend compiler module, not the backend module itself and therefore was not visible.
Cldr Calendars v1.18.0
This is the changelog for Cldr Calendars v1.18.0 released on February 21st, 2022. For older changelogs please consult the release tag on GitHub
Enhancements
- Updates to ex_cldr version 2.26.0 and ex_cldr_numbers version 2.25.0 which use atoms for locale names and rbnf locale names. This is consistent with other elements of
t:Cldr.LanguageTagwhere atoms are used when the cardinality of the data is fixed and relatively small and strings where the data is free format.
Cldr Calendars v1.17.3
This is the changelog for Cldr Calendars v1.17.3 released on January 31st, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix
Kday.nth_kday/3for when thekdayis the same as the day of the week of the date.
Cldr Calendars v1.17.2
This is the changelog for Cldr Calendars v1.17.2 released on December 26th, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
Fixes
Cldr.Calendar.FiscalYear.calendar_for/2. Thanks for @DaTrader for the report. Closes #10.Use
Cldr.Calendar.date_to_iso_days/1in preference toDate.to_gregorian_days/1since the latter is only available in Elixir 1.11 and later. Thanks to @DaTrader for the report. Closes #11.
Cldr Calendars v1.17.1
This is the changelog for Cldr Calendars v1.17.1 released on November 1st, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Ensure compatibility with Elixir 1.13 by marking the implementations of
Calendar.year_of_era/1as@impl trueonly on releases earlier than Elixir 1.13. In Elixir 1.13 the callback isCalendar.year_of_era/3.
Cldr Calendars v1.17.0
This is the changelog for Cldr Calendars v1.17.0 released on October 27th, 2021. For older changelogs please consult the release tag on GitHub
Enhancements
Updates to support CLDR release 40 via ex_cldr version 2.24
Add support for Chinese, Japanese and Korean lunisolar calendars.
Adds
Cldr.Calendar.year_of_era/1that supports eras that might change at any time during a calendar year. This is primarily applicable to the Japanese calendar.Add
Cldr.Calendar.Behaviourthat can beused to factor out a lot of calendar boilerplate for many (but not all) calendar types.Add
year_of_era/3as a callback in theCldr.Calendarbehaviour. This is required because at least one calendar (the Japanese) can change era on any day of the year.
Bug Fixes
- Fix
day_of_week/{3, 4}to be compatible with Elixir 1.12 and also earlier versions - and ensure dialyzer passes on consuming applications.
Deprecations
- Don't call deprecated
Cldr.Config.known_locale_names/1, callCldr.Locale.Loader.known_locale_names/1instead.
Cldr Calendars v1.17.0-rc.3
This is the changelog for Cldr Calendars v1.17.0-rc.3 released on October 25th, 2021. For older changelogs please consult the release tag on GitHub
Deprecations
- Don't call deprecated
Cldr.Config.known_locale_names/1, callCldr.Locale.Loader.known_locale_names/1instead.
Cldr Calendars v1.17.0-rc.2
This is the changelog for Cldr Calendars v1.17.0-rc.2 released on October 25th, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix
day_of_week/{3, 4}to be compatible with Elixir 1.12 and also earlier versions - and ensure dialyzer passes on consuming applications.
Cldr Calendars v1.17.0-rc.1
This is the changelog for Cldr Calendars v1.17.0-rc.1 released on October 25th, 2021. For older changelogs please consult the release tag on GitHub
Deprecations
- Don't call deprecated
Cldr.Config.get_locale/2, useCldr.Locale.Loader.get_config/2instead.
Cldr Calendars v1.17.0-rc.0
This is the changelog for Cldr Calendars v1.17.0-rc.0 released on October 3rd, 2021. For older changelogs please consult the release tag on GitHub
Enhancements
Add support for Chinese, Japanese and Korean lunisolar calendars.
Adds
Cldr.Calendar.year_of_era/1that supports eras that might change at any time during a calendar year. This is primarily applicable to the Japanese calendar.Add
Cldr.Calendar.Behaviourthat can beused to factor out a lot of calendar boilerplate for many (but not all) calendar types.Add
year_of_era/3as a callback in theCldr.Calendarbehaviour. This is required because at least one calendar (the Japanese) can change era on any day of the year.
Cldr Calendars v1.16.0
This is the changelog for Cldr Calendars v1.16.0 released on August 27th, 2021. For older changelogs please consult the release tag on GitHub
This release requires a minimum of Elixir 1.10 in line with supporting the current release and the two previous releases. Therefore Elixir 1.10, 1.11 and 1.12 are supported.
Bug Fixes
- Do not require
ex_cldr_numbersas a dependency.
Cldr Calendars v1.15.3
This is the changelog for Cldr Calendars v1.15.3 released on August 22nd, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fixes a case when
Cldr.Calendar.Kday.kday_after/1would return the same date, not the subsequent one.
Cldr Calendars v1.15.2
This is the changelog for Cldr Calendars v1.15.2 released on August 20th, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix doc errors. Thanks to @maennchen for the report. Doc errors in other
ex_cldrpackages are also updated.
Cldr Calendars v1.15.1
This is the changelog for Cldr Calendars v1.15.1 released on August 8th, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Add
Code.ensure_loaded?(Date)when checking for whether we need to implementDate.day_of_week/3orDate.day_of_week/4since this changed from earlier Elixir versions.
Cldr Calendars v1.15.0
This is the changelog for Cldr Calendars v1.15.0 released on July 1st, 2021. For older changelogs please consult the release tag on GitHub
Enhancements
- Updated to ex_cldr version 2.23.0 which has some changes to the valid territories list requiring a change in some tests. This normally wouldn't require a minor version change but doing so makes it easier to target this library as a dependency.
Cldr Calendars v1.14.1
This is the changelog for Cldr Calendars v1.14.1 released on May 17th, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix
@implwarnings on Elixir 1.12
Cldr Calendars v1.14.0
This is the changelog for Cldr Calendars v1.14.0 released on April 13th, 2021. For older changelogs please consult the release tag on GitHub
Enhancements
- Support creating time-base durations that are negative in direction. Date and DateTime durations must still be positive durations. For example:
# Create a time-based duration that is negative in direction iex> {:ok, duration} = Cldr.Calendar.Duration.new ~T[10:00:00.0], ~T[09:00:00.0] {:ok, %Cldr.Calendar.Duration{ day: 0, hour: -1, microsecond: 0, minute: 0, month: 0, second: 0, year: 0 }}
Cldr Calendars v1.13.0
This is the changelog for Cldr Calendars v1.13.0 released on April 8th, 2021. For older changelogs please consult the release tag on GitHub
Enhancements
Cldr Calendars v1.12.1
This is the changelog for Cldr Calendars v1.12.1 released on April 7th, 2021. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix a bug that prevented durations being created from times (as apposed to dates and datetimes)
Cldr Calendars v1.12.0
This is the changelog for Cldr Calendars v1.12.0 released on November 8th, 2020. For older changelogs please consult the release tag on GitHub
Enhancements
Rename
Cldr.Calendar.Preference.calendar_for_locale/1toCldr.Calendar.Preference.calendar_from_locale/1Rename
Cldr.Calendar.Preference.calendar_for_territory/1toCldr.Calendar.Preference.calendar_from_territory/1Add
Cldr.Calendar.calendar_from_locale/1,2
Cldr Calendars v1.11.0
This is the changelog for Cldr Calendars v1.11.0 released on November 1st, 2020. For older changelogs please consult the release tag on GitHub
Enhancements
- Add support for CLDR 38
Cldr Calendars v1.10.1
This is the changelog for Cldr Calendars v1.10.1 released on September 26th, 2020. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Add a shim for
default_backend/0that delegates toCldr.default_backend/0orCldr.default_backend!/0depending onex_cldrrelease. Releases from2.18.0useCldr.default_backend!/0.
Cldr Calendars v1.10.0
This is the changelog for Cldr Calendars v1.10.0 released on August 29th, 2020. For older changelogs please consult the release tag on GitHub
Enhancements
- Supports upcoming Elixir 1.11.0. The
Calendarcallback forday_of_week/3has been changed today_of_week/4to allow for a different start day of week. SinceCldr Calendarsalready supports defining calendars with different start days of the week (ie other than Monday), the implementation only supports the:defaultparameter. Thanks to @lostkobrakai for the report. ClosesCldr Dates Timesissue #17.
Cldr Calendars v1.9.0
This is the changelog for Cldr Calendars v1.9.0 released on June 7th, 2020. For older changelogs please consult the release tag on GitHub
Enhancements
Add
Cldr.Calendar.plus/{3,4}that allows adding aCldr.Calendar.Durationto aCalendar.date. Support for adding durations todatetimes is not yet available.Add support for
datetimestoCldr.Calendar.Duration.new/2Add support for
Date.Range.tandCalendarInterval.ttoCldr.Calendar.Duration.new/1
Bug Fixes
- More complete test coverage on durations with some additional corner case fixes
Cldr Calendars v1.8.1
This is the changelog for Cldr Calendars v1.8.1 released on June 4th, 2020. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix duration calculation when the year and month are the same and the day of the last date is greater than the day of the first date
Cldr Calendars v1.8.0
This is the changelog for Cldr Calendars v1.8.0 released on May 4th, 2020. For older changelogs please consult the release tag on GitHub
Breaking Change (that you might notice but probably won't)
- The
min_days_in_first_weekfor the calendarCldr.Calendar.Gregorianis changed to be1rather than the previous value of4. This only affects week-related processing for the calendar. The reason for the change is that the majority of territories have a preference for1formin_days_in_first_weeksoCldr.Calendar.Gregorianmore closely aligns to majority expectations.
Breaking changes (that you shouldn't notice)
- The return result from
Cldr.Calendar.new/3may return{:module_already_exists, module}. It previously returned{:already_exists, module}
Bug Fixes
Use
backend.get_locale/0instead ofCldr.get_locale/0for all optionsEnsure that the default values for a locale's
min_daysandfirst_day_of_weekare correctly applied inCldr.Calendar.new/3. Any values passed as options take precedence over those defined for a locale.
Enhancements
Add
Cldr.Calendar.calendar_for_locale/2which will create (or return) a gregorian-based calendar configured for the supplied locale. This typically means applying the correct values formin_daysandfirst_day_of_week. For now all calendars created in this way are Gregorian monthly calendars.Add
Cldr.Calendar.Preference.calendar_for_locale/1which returns the appropriate calendar for a locale based upon locale preferences and configured calendars. UnlikeCldr.Calendar.calendar_for_locale/2, this function may return non-Gregorian calendars. For example, for the localefa-IRit will returnCldr.Calendar.Persian(if ex_cldr_calendars_persian is configured) because that is the locale preference.Add
Cldr.Calendar.Preference.calendar_for_territory/1provides the same result asCldr.Calendar.Preference.calendar_for_locale/2except that argument is a territory code.Add
Cldr.Calendar.Preference.preferences_for_territory/1Add
Cldr.Calendar.validate_calendar/1which returns{:ok, calendar}if the argument is aCldr.Calendarcalendar module or{:error, {exception, reason}}if not.
Cldr Calendars v1.7.1
This is the changelog for Cldr Calendars v1.7.1 released on January 26th, 2020. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix doc link in
MyApp.Cldr.Calendar.strftime_options!/2
Cldr Calendars v1.7.0
This is the changelog for Cldr Calendars v1.7.0 released on January 2nd, 2020. For older changelogs please consult the release tag on GitHub
Enhancements
- Remove call to deprecated
Code.ensure_compiled?/1in Elixir 1.10
Cldr Calendars v1.6.0
This is the changelog for Cldr Calendars v1.6.0 released on December 9th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds support for localizing Persian, Coptic and Ethiopic calendar localization. These calendars are published separately but they rely upon localization support from this package.
Cldr Calendars v1.5.1
This is the changelog for Cldr Calendars v1.5.1 released on November 10th, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix
Cldr.Calendar.next/3andCldr.Calendar.previous/3for months with week-based calendars. Thanks to @bglusman for the report. Closes #3. Note that the use of the:coerceoption is recommended in most cases.
Cldr Calendars v1.5.0
This is the changelog for Cldr Calendars v1.5.0 released on November 3rd, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds
MyApp.Cldr.Calendar.strftime_options!/2to return a keyword list of options that can be applied toNimbleStrftime.format/3
Cldr Calendars v1.4.0
This is the changelog for Cldr Calendars v1.4.0 released on September 14th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
- Adjusts
<calendar>.add/3to<calendar>.add/5so that it takes individual date and time elements and not formal structs. This is consistent with other calendar behaviours.
Cldr Calendars v1.3.0
This is the changelog for Cldr Calendars v1.3.0 released on September 1st, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
Adds <calendar>.add/3 to add :quarter or :week to a naive datetime. This adds to the existing support for :year and :month.
Cldr Calendars v1.2.0
This is the changelog for Cldr Calendars v1.2.0 released on August 31st, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
Adds
Cldr.Calendar.Durationto create a duration struct defining the difference between two dates, times or date_times as a calendar difference in years, months, days, hours, minutes, seconds and microseconds. SeeCldr.Calendar.Duration.new/2andCldr.Calendar.Duration.to_string/1.Changes
sigil_d/2from a function to a macro so that dates are created at compile time
Cldr Calendars v1.1.0
This is the changelog for Cldr Calendars v1.1.0 released on August 30th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
Adds
<calendar>.add/3to add:yearor:monthto a naive datetime. This function supports the library calendar_interval allowing intervals to be used withex_cldr_calendars[https://hex.pm/packages/ex_cldr_calendars]. The mid-term objective is to addadd/3to theCalendarbehaviour and thereby also simplify the interface toCalendarInterval.Changes the output of
to_string/1to consistently use the full name of the calendar module, not an appreviated name.
Cldr Calendars v1.0.0
This is the changelog for Cldr Calendars v1.0.0 released on June 16th, 2019. For older changelogs please consult the release tag on GitHub
Breaking changes
The format produced by inspecting a Date (or DateTime or NaiveDateTime) has changed. The parsing of dates in
sigil_d(the~dsigil) has also changed in order to facilitate roundtrip conversions. Previously a date would inspect as (using the NRF calendar)~d[2019-W01-1]NRF. It now inspects as~d[2019-W01-1 NRF]. The same approach is used for all calendars. See the examples inCldr.Calendar.Sigils. This change is applicable to Elixir 1.10 and later.The calendar configuration option
:min_dayshas been renamed:min_days_in_first_week. The configuration option:dayhas been renamed to:day_of_weekand the option:monthhas been renamed to:month_of_year. An exception will be raised if existing calendars are not updated.An exception will be raised if a calendar is configured with an unknown option.
Enhancements
Implements
inspect_date/4,inspect_datetime/11,inspect_naive_datetime/8andinspect_time/5for allCldr.Calendarcalendars. This implementation supports the revisedInspectprotocol implementation forDate,Time,DateTimeandNaiveDateTimestructs. The purpose of that change is to allow customer calendars to be inspected. This change is applicable to Elixir 1.10 and later.Adds
Cldr.Calendar.week_of_month/1andCldr.Calendarcallbackweek_of_month/4to return the week of a month. The weeks are calculated on the basis of the calendar configuration. As a result, the week of the month, like the week of the year, may be in a different Gregorian year and month compared to the specified date.Adds
Cldr.Calendar.weeks_in_year/1to return the number of weeks in a year.Adds a calendar configuration where weeks start on the first day of the year. This configuration is valid only for
:monthbased calendars. The configuration optionday: :firsttriggers this behaviour. This configuration can result in the last week of the year being less than 7 days.Adds
Cldr.Calendar.inspect/2that can be used as an:inspect_funoption inInspect.Optsfor Elixir version 1.9. It will not be required for Elixir 1.10 and later since this commit introducesinspect_*callbacks forDate,Time,DateTimeandNaiveDateTime. An:inspect_funcan be configured inIExby:
iex> IEx.configure(inspect: [inspect_fun: &Cldr.Calendar.inspect/2])
:okBug Fixes
Ensure that
Cldr.Calendarcallbacks return aCalendar.ISOcalendar if called with one (either as part of a date or as a separate argument).Ensure the return calendar types of a an Interval are
Calendar.ISOis the date provided isCalendar.ISOFix
Cldr.Calendar.plus/4for:monthswhen the month wraps into the previous year(s)Fix
sigil_dto correctly parse ISO Week dates that have only a single digit day
Cldr Calendars v0.9.0
This is the changelog for Cldr Calendars v0.9.0 released on June 9th, 2019. For older changelogs please consult the release tag on GitHub
Breaking changes
- Depends on Elixir 1.8 and above since it requires recent
Calendarfunctionality.
Cldr Calendars v0.8.0
This is the changelog for Cldr v0.8.0 released on June 8th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
Adds option
:typetoCldr.Calendar.localize/3. This determines the format type to be localized. The valid types are:format(the default) or:stand_alone.Add
Cldr.Calendar.day_periods/2to support localization of the day periods of a timeAdd
Cldr.Calendar.default_calendar/0. ReturnsCldr.Calendar.GregorianAdd
Cldr.Calendar.default_cldr_calendar/0. Returns:gregorian
Cldr Calendars v0.7.0
This is the changelog for Cldr Calendars v0.7.0 released on June 1st, 2019. For older changelogs please consult the release tag on GitHub
Breaking Changes
- Moved
year/1,quarter/1,month/1,week/1andday/1to a new moduleCldr.Calendar.Interval
Enhancements
Adds
Cldr.Calendar.Interval.compare/2to compare two intervals (date ranges) using Allen's Interval Algebra taxonomy.Defaults the calendar to
Cldr.Calendar.GregorianforCldr.Calendar.Interval.year/2,Cldr.Calendar.Interval.quarter/3,Cldr.Calendar.Interval.month/3,Cldr.Calendar.Interval.week/3andCldr.Calendar.Interval.day/3
Cldr Calendars v0.6.0
This is the changelog for Cldr Calendars v0.6.0 released on April 28th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
- Remove the need for nimble_csv as a dependency
Cldr Calendars v0.5.0
This is the changelog for Cldr Calendars v0.5.0 released on April 21th, 2019. For older changelogs please consult the release tag on GitHub
Breaking changes
Cldr.Calendar.localize/3for:days_of_weeknow returns a list of 2-tuples that are of the format{day_of_week, day_name}.
Enhancements
- Add
Cldr.Calendar.localize/6which localises numbers as part of a date without parameter checking. This is considered a private implementation for now.
Cldr Calendars v0.4.1
This is the changelog for Cldr Calendars v0.4.1 released on April 19th, 2019. For older changelogs please consult the release tag on GitHub
Bug Fixes
- Fix calculation of
days_in_monthfor the last month in long year of a week-based calendar
Cldr Calendars v0.4.0
This is the changelog for Cldr Calendars v0.4.0 released on April 19th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
Adds
Cldr.Calendar.interval_stream/3which returns a stream function that when enumerated generates a list of dates with a specified precision of either:years,:quarters,:months,:weeksor:days. This function has the same arguments and generates the same results asCldr.Calendar.interval/3except it generates the results lazily.Adds
:days_of_weekoption toCldr.Calendar.localize/3which returns a list of the localized names of the days of the week in calendar order.Adds
calendar_base/0to identify whether the calendar is week or month based.
Bug Fixes
- Fix
Cldr.Calendar.day_of_week/1for week-based calendars
Cldr Calendars v0.3.0
This is the changelog for Cldr Calendars v0.3.0 released on April 16th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
- Adds
Cldr.Calendar.interval/3which generates an enumerable list of dates with a specified precision of either:years,:quarters,:months,:weeksor:days.
Examples:
iex> import Cldr.Calendar.Sigils
Cldr.Calendar.Sigils
iex> d = ~d[2019-01-31]
%Date{calendar: Cldr.Calendar.Gregorian, day: 31, month: 1, year: 2019}
iex> d2 = ~d[2019-05-31]
%Date{calendar: Cldr.Calendar.Gregorian, day: 31, month: 5, year: 2019}
iex> Cldr.Calendar.interval d, 3, :months
[
%Date{calendar: Cldr.Calendar.Gregorian, day: 28, month: 2, year: 2019},
%Date{calendar: Cldr.Calendar.Gregorian, day: 31, month: 3, year: 2019},
%Date{calendar: Cldr.Calendar.Gregorian, day: 30, month: 4, year: 2019}
]
iex> Cldr.Calendar.interval d, d2, :months
[
%Date{calendar: Cldr.Calendar.Gregorian, day: 31, month: 1, year: 2019},
%Date{calendar: Cldr.Calendar.Gregorian, day: 28, month: 2, year: 2019},
%Date{calendar: Cldr.Calendar.Gregorian, day: 31, month: 3, year: 2019},
%Date{calendar: Cldr.Calendar.Gregorian, day: 30, month: 4, year: 2019},
%Date{calendar: Cldr.Calendar.Gregorian, day: 31, month: 5, year: 2019}
]Cldr Calendars v0.2.0
This is the changelog for Cldr Calendars v0.2.0 released on April 14th, 2019. For older changelogs please consult the release tag on GitHub
Breaking Changes
All calendars now return
{year, month, day}tuples fromdate_from_iso_days/1. Previously in some cases they returned aDate.tfirst_day_of_year/1andlast_day_of_year/1,first_gregorian_day_of_year/1andlast_gregorian_day_of_year/1now all return aDate.tor an error tuple. Previously the returned result types were inconsistent.Remove
first_gregorian_day_of_year/1andlast_gregorian_day_of_year/1fromCldr.Calendarcallbacks.
Enhancements
- Adds
Cldr.Calendar.Julianimplementing the Julian calendar. This calendar does not implementweek/2,week_of_year/3oriso_week_of_year/3.
Bug Fixes
- Fixes calculating negative offsets for months in a week-based calendar. Thanks to @bglusman. Closes #2.
Cldr Calendars v0.1.0
This is the changelog for Cldr Calendars v0.1.0 released on April 5th, 2019. For older changelogs please consult the release tag on GitHub
Enhancements
- Initial release. See the README for a description of this project.