EZCalendar v0.1.5 EZCalendar.Calendar behaviour

Behaviour definition for calendar types.

Summary

Callbacks

The first argument is a list of calendar dates containing the query results for each respective day

The first argument is a date erl parsed from the params

Types

calendar()
calendar :: struct
date()
dates()
dates :: list
opts()
opts :: list

Callbacks

build(dates, date)
build(dates, date) :: [calendar]

The first argument is a list of calendar dates containing the query results for each respective day.

The second argument is the date erl parsed from the params.

Returns a calendar struct that should include the following fields:

:title a string defining the current calendar

:dates the list of date structs

:params a map with the keys :day, :month and :year representing the current date period

:next a map with the keys :day, :month and :year representing the next date period

:prev a map with the keys :day, :month and :year representing the previous date period

You can add extra fields to your calendar but these are required for it to function properly.

date_range(date, opts)
date_range(date, opts) :: [tuple]

The first argument is a date erl parsed from the params.

The second argument is the options.

Returns a 2 item Date type tuple representing the calendars start and end for the given date.

{~D[2016-10-30], ~D[2016-11-04]}