Skip to content

Applying business days and public holidays

Simon Nebesnuick edited this page Nov 29, 2023 · 1 revision

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 acocunt 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