Cldr Calendars Format v0.4.0 Cldr.Calendar.Formatter.Options View Source

Defines and validates the options for a calendar formatter.

These options are passed to the formatter callbacks defined in Cldr.Calendar.Formatter.

The valid options are:

  • :calendar is an calendar module defined with use Cldr.Calendar.

  • :backend is any module that applied use Cldr. The default is Cldr.default_backend().

  • :formatter is any module implementing the Cldr.Calendar.Formatter behaviour.

  • :locale is any locale returned by Cldr.validate_locale/1. The default is Cldr.get_locale().

  • :number_system is any valid number system name or number system type for the given locale. Available number systems for a locale are returned by Cldr.Number.System.number_systems_for(locale, backend). The default is :default.

  • :territory is any territory returned by Cldr.validate_territory/1 The default is Cldr.Locale.territory_from_locale/1.

  • :caption is a caption to be applied in any way defined by the :formatter. The default is nil.

  • :class is a class name that can be used any way defined by the :formatter. It is most commonly used to apply an HTML class to an enclosing tag. The default is Cldr.Calendar.Format.default_calendar_css_class/0

  • :id is an id that can be used any way defined by the :formatter. It is most commonly used to apply an HTML id to an enclosing tag. The default is nil

  • :private is for your private use in your formatter. For example if you wanted to pass a selected day and format it differently, you could provide options.private = %{selected: ~D[2020-04-05]} and take advantage of it while formatting the days.

  • :today is any Date.t that represents today. It is commonly used to allow a formatting to appropriately format a date that is today differently to other days on a calendar. The default is Date.utc_today/0

  • :day_names is a list of 2-tuples that map the day of the week to a localised day name that are most often used as headers for a month. The default is automatically calculated from the provided :calendar and :locale.

Link to this section Summary

Types

t()

Formatter options

Link to this section Types

Link to this type

t()

View Source
t() :: %Cldr.Calendar.Formatter.Options{
  backend: module(),
  calendar: module(),
  caption: String.t() | nil,
  class: String.t() | nil,
  day_names: [{1..7, String.t()}],
  formatter: module(),
  id: String.t() | nil,
  locale: Cldr.LanguageTag.t(),
  number_system: Cldr.Number.System.system_name(),
  private: any(),
  territory: atom() | String.t(),
  today: Date.t()
}

Formatter options

Link to this section Functions

Link to this function

validate_option(arg1, options, calendar)

View Source