-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Replace "Europe/Kiev" timezone with "Europe/Kyiv" #51703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Hi Serhii I think it is not good idea because of backward compatibility in applications that use RDBMS timezones and map it using Active Support. For example, PostgreSQL
I believe it's better firstly to add aliases to PostgreSQL (and other systems), and after that make this change |
@mechnicov, thank you for raising these issues. I work closely with PostgreSQL and MySQL. Can't provide much information about other RDBMSs. PostgreSQL respects IANA (Olson) time zone database (https://www.postgresql.org/docs/16/datatype-datetime.html#DATATYPE-TIMEZONES) and there should be no issues in a long run. MySQL does not follow IANA according to documentation (https://dev.mysql.com/doc/refman/8.0/en/time-zone-support.html#time-zone-installation). Though, it provides good tooling to import system timezone data. With that information, I can state that the output of |
For reasons explained previously, we can't do this because it is a breaking change. |
Sorry I just saw Rafael's comment: I would add that buster (which is not EoL for another 2 months) doesn't have the updated tzdata: |
For the record, I started having this problem after upgrading to Ubuntu 24.04.1 LTS. It looks like the alias is no longer present in TZinfo and now I get I tried the monkeypatch in description as a temporary workaround (I understand it cannot be changed just like that as it could break with older version of TZinfo). But I can't get it to work, in my case I get: patches.rb:18:in `block in <main>': undefined method `tzinfo' for nil:NilClass
warn("Remove timezone patch for '#{tzinfo_name}' at #{__FILE__}:#{__LINE__}") if time_zone.tzinfo.name == tzinfo_name
^^^^^^^ (NoMethodError) Because the "Kyiv" key is not present in the Edit: In the end I patched the if ActiveSupport::TimeZone::MAPPING['Kyiv'] == "Europe/Kyiv"
warn("Remove timezone patch for Kyiv at #{__FILE__}:#{__LINE__}")
else
ActiveSupport::TimeZone::MAPPING['Kyiv'] = "Europe/Kyiv"
end 🟢 And it's working as expect now on both Ubuntu 24.04 and 22.04 because they both have "Europe/Kyiv" support (22.04 supported both options and 24.04 only supports "Europe/Kyiv") |
The workaround provided above (overriding the The trigger for the issues was updating our infrastructure from Ubuntu 22 to Ubuntu 24 (i.e. the This caused some frustration and confusion and it was hard to pinpoint either Rails, TZInfo or Ubuntu as the culprit. While not the "fault" of Rails, I think Rails could (and is best placed) to do more to ease the transition from Would it be a potential solution to update the mapping in ActiveSupport::TimeZone to dynamically determine whether This proposal could (crudely) be implemented as follows (and indeed this is an alternative / more robust of the above suggested workaround; if TZInfo::Timezone.all.map(&:name).include?('Europe/Kyiv')
# The underlying OS considers Europe/Kyiv a valid timezone, so map Kyiv to that
ActiveSupport::TimeZone::MAPPING['Kyiv'] = 'Europe/Kyiv'
else
# The underlying OS does not consider Europe/Kyiv a valid timezone, so leave mapping as Europe/Kiev
end |
For the record I noticed other problematic TZ after some time with Ubuntu 24.04 in production. namely { 'Kyiv' => 'Europe/Kyiv',
'Rangoon' => 'Asia/Yangon',
'Greenland' => 'America/Nuuk' }.each do |name, tzinfo|
if ActiveSupport::TimeZone::MAPPING[name] == tzinfo
warn("Timezone patch not necessary for #{name} at #{__FILE__}:#{__LINE__}")
else
ActiveSupport::TimeZone::MAPPING[name] = tzinfo
end
end |
I validate timezones against |
Motivation / Background
This Pull Request has been created because of the request to use common timezone name "Europe/Kyiv" instead of the "Europe/Kiev". There are a few approaches to introduce this change in the rails repo:
All mentioned related sources are changed in the last couple of years:
Detail
This Pull Request changes internal tzinfo data from "Europe/Kiev" to "Europe/Kyiv" for
ActiveSupport::TimeZone
.Additional information
Current workaround:
This update may break some existing applications that rely on time zone names. Though, the data migration should be trivial.
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]