diff --git a/.changeset/new-lamps-poke.md b/.changeset/new-lamps-poke.md new file mode 100644 index 0000000000..c26bf263e7 --- /dev/null +++ b/.changeset/new-lamps-poke.md @@ -0,0 +1,5 @@ +--- +'@primer/view-components': patch +--- + +Fix: Allow month attribute for Primer::Beta::RelativeTime diff --git a/app/components/primer/beta/relative_time.rb b/app/components/primer/beta/relative_time.rb index 65c1411f56..5cf5192816 100644 --- a/app/components/primer/beta/relative_time.rb +++ b/app/components/primer/beta/relative_time.rb @@ -52,7 +52,7 @@ class RelativeTime < Primer::Component MONTH_DEFAULT = nil MONTH_MAPPINGS = { - DAY_DEFAULT => nil, + MONTH_DEFAULT => nil, :numeric => "numeric", :two_digit => "2-digit", :short => "short", @@ -63,7 +63,7 @@ class RelativeTime < Primer::Component YEAR_DEFAULT = nil YEAR_MAPPINGS = { - DAY_DEFAULT => nil, + YEAR_DEFAULT => nil, :numeric => "numeric", :two_digit => "2-digit" }.freeze @@ -71,7 +71,7 @@ class RelativeTime < Primer::Component TIMEZONENAME_DEFAULT = nil TIMEZONE_MAPPINGS = { - DAY_DEFAULT => nil, + TIMEZONENAME_DEFAULT => nil, :long => "long", :short => "short", :short_offset => "shortOffset", @@ -131,7 +131,7 @@ def initialize( @system_arguments[:hour] = fetch_or_fallback(HOUR_OPTIONS, hour, HOUR_DEFAULT) if hour.present? @system_arguments[:weekday] = fetch_or_fallback(WEEKDAY_OPTIONS, weekday, WEEKDAY_DEFAULT) if weekday.present? @system_arguments[:day] = fetch_or_fallback(DAY_OPTIONS, day, DAY_DEFAULT) if day.present? - @system_arguments[:month] = fetch_or_fallback(MONTH_DEFAULT, month, MONTH_DEFAULT) if month.present? + @system_arguments[:month] = fetch_or_fallback(MONTH_OPTIONS, month, MONTH_DEFAULT) if month.present? @system_arguments[:year] = fetch_or_fallback(YEAR_OPTIONS, year, YEAR_DEFAULT) if year.present? @system_arguments[:"time-zone-name"] = fetch_or_fallback(TIMEZONENAME_OPTIONS, time_zone_name, TIMEZONENAME_DEFAULT) if time_zone_name.present? @system_arguments[:threshold] = threshold if threshold.present?