Skip to content

Applying business days and public holidays

Simon Nebesnuick edited this page Jun 4, 2024 · 2 revisions

When we send emails to visitors. we let them know how long it should take to review their booking request. To do this effectively, we need to take into account working days and also public holidays.

We use a yml file to configure the business days that the service support in lib/calendars which is based on GitHub - gocardless/business: Ruby business day calculations.

The corresponding yml file https://github.com/ministryofjustice/prison-visits-2/blob/feature/upgrade-to-rails-7.1.2/lib/calendars/bacs.yml

This yml file currently supports bank holidays up to 2027 and it could be further modified for each calendar year as needed.

Where this file is used

Here is the definition of which yml file the gem will use https://github.com/ministryofjustice/prison-visits-2/blob/main/config/initializers/calendar.rb

This is where the calendar object is been used https://github.com/ministryofjustice/prison-visits-2/blob/main/app/models/prison.rb#L109