mix tempo.holidays.update (Tempo.Holidays v0.1.0)

Copy Markdown View Source

Download a date-holidays release and compile it into the holiday data Tempo.Holidays reads.

Tempo.Holidays ships data built from the release it pins. A newer release carries corrections and new holidays before a new tempo_holidays does: this task builds the data from any release, into a directory of your application that the library then reads instead of its own.

In your application

Name a directory in your application's priv for the data:

# config/config.exs
config :tempo_holidays, data_dir: {:my_app, "holidays"}

then build it from the release you want:

mix tempo.holidays.update --version 3.38.0

The data is written to priv/holidays of your project, so it goes into a release with your application and can be committed with it. Tempo.Holidays.Data.version/0 says which release is loaded. An absolute path is also accepted as data_dir.

The data is read only while it is in the format of the tempo_holidays release that reads it: after an upgrade of tempo_holidays that changes the format, the package's own data is read until the task is run again.

In tempo_holidays itself

The task writes the package's own priv/holidays, which the :holidays compiler builds on a cold build from the pinned release. Run it after the pinned version (Tempo.Holidays.Build) is bumped.

Usage

mix tempo.holidays.update
mix tempo.holidays.update --version 3.38.0
mix tempo.holidays.update --language es

Options

  • --version — the date-holidays release, three numbers such as 3.38.0. The default is the release tempo_holidays pins.

  • --language — the ISO 639-1 code for holiday names. The default is en.