Skip to content

[Data] Normalize all dates in releases.yml to Date instead of String #3566

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

Merged
merged 1 commit into from
May 13, 2025

Conversation

epistrephein
Copy link
Contributor

In _data/releases.yml, 3 of the total 222 dates under the date: key are represented with quotes instead of without.

This has the side effect that when the file is YAML-parsed, these dates are parsed as Strings instead of Dates, creating an unwanted inconsistency of classes.

This PR normalizes the 3 dates removing the quotes so that they're all parsed as Date class.

require 'yaml'
yaml = YAML.unsafe_load_file('_data/releases.yml')

# master
yaml.filter_map { |i| i['version'] unless i['date'].is_a?(Date) }
# => ["3.3.8", "3.2.8", "3.1.7"]
yaml.find { |i| i['version'] == '3.2.8' }['date']
# => "2025-03-26"


# this branch
yaml.filter_map { |i| i['version'] unless i['date'].is_a?(Date) }
# => []
yaml.find { |i| i['version'] == '3.2.8' }['date']
# => #<Date: 2025-03-26 ((2460761j,0s,0n),+0s,-Infj)>

(see #3375 and #3146 for a similar fix some time ago)

@epistrephein epistrephein requested a review from a team as a code owner May 13, 2025 11:06
@hsbt hsbt merged commit 99360b1 into ruby:master May 13, 2025
1 check passed
@epistrephein epistrephein deleted the releases-date-normalize branch May 14, 2025 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants