#57109·rails

The `Time.days_in_month` method does not take into account the Gregorian Calendar Reform

Author: broekhuis00Created Mar 31, 2026Updated Sep 28, 2026

Steps to reproduce

ruby
# Activesupport
Time.days_in_month(10, 1582) # => 31
Time.days_in_month(9, 1752) # => 30

# Ruby core
# When Italy had the reform
(Date.new(1582,10,1)..Date.new(1582,10,-1)).count # => 21
# When England (and colonies) had the reform
(Date.new(1752, 9,1, Date::ENGLAND)..Date.new(1752, 9,-1, Date::ENGLAND)).count # => 19 

Expected behavior

Either:

  • days_in_month (and by proxy days_in_year) take into account the Gregorian Calendar Reform, and allow specifying for which region.
  • Document on the method that this not taken into account.

Actual behavior

days_in_month do not take into account the reform, and it is not stated in the documentation.

System configuration

Rails version: Rails 8.1.3

Ruby version: ruby 4.0.1

Additional sources