Calendrical. Formatter behaviour
(Calendrical v0.8.0)
Copy Markdown
Calendar formatter behaviour.
This behaviour defines a set of callbacks that are invoked during the formatting of a calendar.
At each point in the formatting process the callbacks are invoked
from the "inside out". That is, format_day/4 is invoked for each
day of the week, then format_week/5 is called, then
format_month/4 and finally format_year/3 is called if
required.
Summary
Callbacks
Returns the formatted calendar for a day.
Returns the formatted calendar for a month.
Returns the formatted calendar for a week.
Returns the formatted calendar for a year.
Callbacks
@callback format_day( date :: Date.t(), year :: Calendar.year(), month :: Calendar.month(), options :: map() ) :: any()
Returns the formatted calendar for a day.
Arguments
dateis theDate.t/0of the day being formatted.yearis the year for which the calendar is requested.monthis the month for which the calendar is requested.optionsis a keyword list of formatter options.
Returns
- An arbitrary result as required by the implementing formatter,
which is passed to
format_week/5.
@callback format_month( formatted_weeks :: String.t(), year :: Calendar.year(), month :: Calendar.month(), options :: map() ) :: any()
Returns the formatted calendar for a month.
Arguments
formatted_weeksis the result returned byformat_week/5.yearis the year for which the calendar is requested.monthis the month for which the calendar is requested.optionsis a keyword list of formatter options.
Returns
- An arbitrary result as required by the implementing formatter,
which is either returned (if called by
Calendrical.Format.month/3) or passed toformat_year/3if not.
@callback format_week( formatted_days :: String.t(), year :: Calendar.year(), month :: Calendar.month(), week_number :: {Calendar.year(), pos_integer()}, options :: map() ) :: any()
Returns the formatted calendar for a week.
Arguments
formatted_daysis the result returned byformat_day/4.yearis the year for which the calendar is requested.monthis the month for which the calendar is requested.week_numberis a 2-tuple of the form{year, week_number}that represents the week-of-year for the week to be formatted.optionsis a keyword list of formatter options.
Returns
- An arbitrary result as required by the implementing formatter,
which is passed to
format_month/4.
@callback format_year( formatted_months :: String.t(), year :: Calendar.year(), options :: map() ) :: any()
Returns the formatted calendar for a year.
Arguments
formatted_monthsis the result returned byformat_month/4.yearis the year for which the calendar is requested.optionsis a keyword list of formatter options.
Returns
- An arbitrary result as required by the implementing formatter.