Ruby gem for determining business days based on the SIFMA holiday schedule for financial institutions. Covers the United States, the United Kingdom, and Japan.
For US equity market trading calendar, see Bourse.
All methods accept an optional Date parameter, which defaults to Date.today.
Commercial::US.business_day?(date) # => true if banks are open
Commercial::US.holiday?(date) # => true if US holiday
Commercial::US.weekend?(date) # => true if Saturday/SundayCommercial::US.next_business_day(date) # => next business day after date
Commercial::US.prev_business_day(date) # => previous business day before date
Commercial::US.latest_business_day(date) # => most recent business day on or before date
Commercial::US.succ(date) # => alias for next_business_day
Commercial::US.pred(date) # => alias for prev_business_dayinclude Commercial
# United States
US.business_day?(Date.new(2025, 4, 18)) # => false (Good Friday)
US.holiday?(Date.new(2025, 7, 4)) # => true (Independence Day)
# United Kingdom
GB.business_day?(Date.new(2024, 12, 26)) # => false (Boxing Day)
GB.boxing_day?(Date.new(2024, 12, 26)) # => true
# Japan (uses holiday_japan gem)
JP.business_day?(Date.new(2025, 5, 5)) # => false (Children's Day)
JP.shogatsu?(Date.new(2025, 1, 3)) # => true
# Navigation
US.next_business_day(Date.new(2025, 7, 4)) # => 2025-07-07 (skips holiday & weekend)
US.prev_business_day(Date.new(2025, 1, 6)) # => 2025-01-03 (skips weekend)
US.latest_business_day(Date.new(2025, 1, 4)) # => 2025-01-03 (Saturday back to Friday)
# Cross-market checks
date = Date.new(2024, 12, 26) # Boxing Day
GB.business_day?(date) && US.business_day?(date) # => false (UK closed)
JP.business_day?(date) && US.business_day?(date) # => true (JP & US open)See source code or type signatures for complete method list.
Run bin/setup to install dependencies, then rake to run tests.
To validate the type signatures:
rbs -I sig -r date validateTo generate documentation:
rake docThe gem is available as open source under the terms of the MIT License.