From 21bcfc620209ee35a8fe1ab9b1ab2f391cf62f05 Mon Sep 17 00:00:00 2001
From: David Kim <dkim@gitlab.com>
Date: Fri, 30 Jun 2023 18:11:12 +0930
Subject: [PATCH] Change to_s(:medium) to to_fs(medium)

Passing a format to to_s has been deprecated and replaced with to_fs in
Rails 7.

https://github.com/rails/rails/blob/de7c495209811f8f918fa9f915e64df61a6080c1/guides/source/7_0_release_notes.md#deprecations-8
---
 app/controllers/concerns/membership_actions.rb            | 2 +-
 app/helpers/issuables_helper.rb                           | 2 +-
 app/helpers/timeboxes_helper.rb                           | 4 ++--
 app/models/concerns/milestoneish.rb                       | 4 ++--
 app/models/deployment.rb                                  | 2 +-
 app/views/admin/groups/show.html.haml                     | 2 +-
 app/views/admin/projects/show.html.haml                   | 6 +++---
 app/views/admin/users/_profile.html.haml                  | 2 +-
 app/views/admin/users/show.html.haml                      | 8 ++++----
 app/views/notify/issue_due_email.html.haml                | 2 +-
 app/views/profiles/keys/_key_details.html.haml            | 2 +-
 app/views/profiles/two_factor_auths/show.html.haml        | 2 +-
 app/views/projects/issues/service_desk/_issue.html.haml   | 2 +-
 app/views/shared/deploy_tokens/_table.html.haml           | 2 +-
 app/views/shared/members/_member.html.haml                | 2 +-
 app/views/shared/milestones/_sidebar.html.haml            | 4 ++--
 app/views/users/calendar_activities.html.haml             | 2 +-
 doc/development/testing_guide/best_practices.md           | 2 +-
 ee/app/models/iteration.rb                                | 2 +-
 ee/app/presenters/epic_presenter.rb                       | 2 +-
 ee/app/serializers/epic_base_entity.rb                    | 2 +-
 ee/app/views/admin/users/_credit_card_info.html.haml      | 2 +-
 ee/app/views/admin/users/card_match.html.haml             | 4 ++--
 .../personal_access_token_revoked_email.html.haml         | 2 +-
 .../personal_access_token_revoked_email.text.haml         | 2 +-
 .../ssh_key_deleted_email.html.haml                       | 2 +-
 .../ssh_key_deleted_email.text.haml                       | 2 +-
 .../shared/billings/_eoa_bronze_plan_banner.html.haml     | 2 +-
 ee/spec/mailers/credentials_inventory_mailer_spec.rb      | 4 ++--
 spec/controllers/groups/group_members_controller_spec.rb  | 2 +-
 .../projects/project_members_controller_spec.rb           | 2 +-
 spec/features/issues/user_creates_issue_spec.rb           | 2 +-
 spec/features/issues/user_edits_issue_spec.rb             | 2 +-
 .../merge_request/user_sees_deployment_widget_spec.rb     | 2 +-
 spec/services/quick_actions/interpret_service_spec.rb     | 2 +-
 spec/support/helpers/features/iteration_helpers.rb        | 2 +-
 .../features/sidebar/sidebar_due_date_shared_examples.rb  | 2 +-
 37 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/app/controllers/concerns/membership_actions.rb b/app/controllers/concerns/membership_actions.rb
index 31675a5816353..0c15c4d0d3f63 100644
--- a/app/controllers/concerns/membership_actions.rb
+++ b/app/controllers/concerns/membership_actions.rb
@@ -16,7 +16,7 @@ def update
     member_data = if member.expires?
                     {
                       expires_soon: member.expires_soon?,
-                      expires_at_formatted: member.expires_at.to_time.in_time_zone.to_s(:medium)
+                      expires_at_formatted: member.expires_at.to_time.in_time_zone.to_fs(:medium)
                     }
                   else
                     {}
diff --git a/app/helpers/issuables_helper.rb b/app/helpers/issuables_helper.rb
index e247577aed034..6769de6b5cbb6 100644
--- a/app/helpers/issuables_helper.rb
+++ b/app/helpers/issuables_helper.rb
@@ -50,7 +50,7 @@ def sidebar_due_date_tooltip_label(due_date)
   def due_date_with_remaining_days(due_date, start_date = nil)
     return unless due_date
 
-    "#{due_date.to_s(:medium)} (#{remaining_days_in_words(due_date, start_date)})"
+    "#{due_date.to_fs(:medium)} (#{remaining_days_in_words(due_date, start_date)})"
   end
 
   def multi_label_name(current_labels, default_label)
diff --git a/app/helpers/timeboxes_helper.rb b/app/helpers/timeboxes_helper.rb
index 66c9011fbcc18..cb6ed059ec9f9 100644
--- a/app/helpers/timeboxes_helper.rb
+++ b/app/helpers/timeboxes_helper.rb
@@ -109,7 +109,7 @@ def milestone_time_for(date, date_type)
       content = [
         title,
         "<br />",
-        date.to_s(:medium),
+        date.to_fs(:medium),
         "(#{time_ago} #{state})"
       ].join(" ")
 
@@ -172,7 +172,7 @@ def recent_releases_with_counts(milestone, user)
 
   def milestone_tooltip_due_date(milestone)
     if milestone.due_date
-      "#{milestone.due_date.to_s(:medium)} (#{remaining_days_in_words(milestone.due_date, milestone.start_date)})"
+      "#{milestone.due_date.to_fs(:medium)} (#{remaining_days_in_words(milestone.due_date, milestone.start_date)})"
     else
       _('Milestone')
     end
diff --git a/app/models/concerns/milestoneish.rb b/app/models/concerns/milestoneish.rb
index 4f2ea58f36d86..7968fe1cd86f5 100644
--- a/app/models/concerns/milestoneish.rb
+++ b/app/models/concerns/milestoneish.rb
@@ -90,9 +90,9 @@ def upcoming?
   def expires_at
     if due_date
       if due_date.past?
-        "expired on #{due_date.to_s(:medium)}"
+        "expired on #{due_date.to_fs(:medium)}"
       else
-        "expires on #{due_date.to_s(:medium)}"
+        "expires on #{due_date.to_fs(:medium)}"
       end
     end
   end
diff --git a/app/models/deployment.rb b/app/models/deployment.rb
index 5af0216a3ca85..b59b22c10c4c3 100644
--- a/app/models/deployment.rb
+++ b/app/models/deployment.rb
@@ -351,7 +351,7 @@ def deployed_at
   end
 
   def formatted_deployment_time
-    deployed_at&.to_time&.in_time_zone&.to_s(:medium)
+    deployed_at&.to_time&.in_time_zone&.to_fs(:medium)
   end
 
   def deployed_by
diff --git a/app/views/admin/groups/show.html.haml b/app/views/admin/groups/show.html.haml
index 4ba6912690650..5f5f6c986639f 100644
--- a/app/views/admin/groups/show.html.haml
+++ b/app/views/admin/groups/show.html.haml
@@ -43,7 +43,7 @@
           %li
             %span.light= _('Created on:')
             %strong
-              = @group.created_at.to_s(:medium)
+              = @group.created_at.to_fs(:medium)
 
           %li
             %span.light= _('ID:')
diff --git a/app/views/admin/projects/show.html.haml b/app/views/admin/projects/show.html.haml
index 8eb72fa281e0c..0637b0eae4724 100644
--- a/app/views/admin/projects/show.html.haml
+++ b/app/views/admin/projects/show.html.haml
@@ -60,7 +60,7 @@
             %span.light
               = _('Created on:')
             %strong
-              = @project.created_at.to_s(:medium)
+              = @project.created_at.to_fs(:medium)
 
           %li{ class: 'gl-px-5!' }
             %span.light
@@ -158,10 +158,10 @@
               = _("This repository has never been checked.")
             - elsif @project.last_repository_check_failed?
               - failed_message = _("This repository was last checked %{last_check_timestamp}. The check %{strong_start}failed.%{strong_end} See the 'repocheck.log' file for error messages.")
-              - failed_message = failed_message % { last_check_timestamp: @project.last_repository_check_at.to_s(:medium), strong_start: "<strong class='cred'>", strong_end: "</strong>" }
+              - failed_message = failed_message % { last_check_timestamp: @project.last_repository_check_at.to_fs(:medium), strong_start: "<strong class='cred'>", strong_end: "</strong>" }
               = failed_message.html_safe
             - else
-              = _("This repository was last checked %{last_check_timestamp}. The check passed.") % { last_check_timestamp: @project.last_repository_check_at.to_s(:medium) }
+              = _("This repository was last checked %{last_check_timestamp}. The check passed.") % { last_check_timestamp: @project.last_repository_check_at.to_fs(:medium) }
 
             = link_to sprite_icon('question-o'), help_page_path('administration/repository_checks')
 
diff --git a/app/views/admin/users/_profile.html.haml b/app/views/admin/users/_profile.html.haml
index b4f61a1b66523..bb89b5baf28cf 100644
--- a/app/views/admin/users/_profile.html.haml
+++ b/app/views/admin/users/_profile.html.haml
@@ -5,7 +5,7 @@
     %ul.content-list
       %li
         %span.light= _('Member since')
-        %strong= user.created_at.to_s(:medium)
+        %strong= user.created_at.to_fs(:medium)
       - unless user.public_email.blank?
         %li
           %span.light= _('E-mail:')
diff --git a/app/views/admin/users/show.html.haml b/app/views/admin/users/show.html.haml
index ea6525e1b96a9..d793dcaccd51d 100644
--- a/app/views/admin/users/show.html.haml
+++ b/app/views/admin/users/show.html.haml
@@ -86,12 +86,12 @@
           %li
             %span.light= _('Member since:')
             %strong
-              = @user.created_at.to_s(:medium)
+              = @user.created_at.to_fs(:medium)
           - if @user.confirmed_at
             %li
               %span.light= _('Confirmed at:')
               %strong
-                = @user.confirmed_at.to_s(:medium)
+                = @user.confirmed_at.to_fs(:medium)
           - else
             %li
               %span.ligh= _('Confirmed:')
@@ -106,7 +106,7 @@
           %li
             %span.light= _('Current sign-in at:')
             %strong
-              = @user.current_sign_in_at&.to_s(:medium) || _('never')
+              = @user.current_sign_in_at&.to_fs(:medium) || _('never')
 
           %li
             %span.light= _('Last sign-in IP:')
@@ -116,7 +116,7 @@
           %li
             %span.light= _('Last sign-in at:')
             %strong
-              = @user.last_sign_in_at&.to_s(:medium) || _('never')
+              = @user.last_sign_in_at&.to_fs(:medium) || _('never')
 
           %li
             %span.light= _('Sign-in count:')
diff --git a/app/views/notify/issue_due_email.html.haml b/app/views/notify/issue_due_email.html.haml
index 9dd501022dd4d..f1959ce2557a1 100644
--- a/app/views/notify/issue_due_email.html.haml
+++ b/app/views/notify/issue_due_email.html.haml
@@ -5,7 +5,7 @@
   %p
     = assignees_label(@issue)
 %p
-  = sprintf(s_('Notify|This issue is due on: %{issue_due_date}'), { issue_due_date: @issue.due_date.to_s(:medium) }).html_safe
+  = sprintf(s_('Notify|This issue is due on: %{issue_due_date}'), { issue_due_date: @issue.due_date.to_fs(:medium) }).html_safe
 
 - if @issue.description
   .md
diff --git a/app/views/profiles/keys/_key_details.html.haml b/app/views/profiles/keys/_key_details.html.haml
index 4f3d97fb90c60..d835366348a91 100644
--- a/app/views/profiles/keys/_key_details.html.haml
+++ b/app/views/profiles/keys/_key_details.html.haml
@@ -14,7 +14,7 @@
             %strong= ssh_key_usage_types.invert[@key.usage_type]
           %li
             %span.light= _('Created on:')
-            %strong= @key.created_at.to_s(:medium)
+            %strong= @key.created_at.to_fs(:medium)
           %li
             %span.light= _('Expires:')
             %strong= @key.expires_at.try(:to_s, :medium) || _('Never')
diff --git a/app/views/profiles/two_factor_auths/show.html.haml b/app/views/profiles/two_factor_auths/show.html.haml
index 461164e1ae913..bfd6b133a937e 100644
--- a/app/views/profiles/two_factor_auths/show.html.haml
+++ b/app/views/profiles/two_factor_auths/show.html.haml
@@ -101,7 +101,7 @@
                     - else
                       %span.gl-text-gray-500
                         = _("no name set")
-                  %td= registration[:created_at].to_date.to_s(:medium)
+                  %td= registration[:created_at].to_date.to_fs(:medium)
                   %td
                     = render Pajamas::ButtonComponent.new(variant: :danger,
                       href: registration[:delete_path],
diff --git a/app/views/projects/issues/service_desk/_issue.html.haml b/app/views/projects/issues/service_desk/_issue.html.haml
index 04ea6103b832b..5b98712d3eb2a 100644
--- a/app/views/projects/issues/service_desk/_issue.html.haml
+++ b/app/views/projects/issues/service_desk/_issue.html.haml
@@ -33,7 +33,7 @@
           %span.issuable-due-date.d-none.d-sm-inline-block.has-tooltip{ class: "#{'cred' if issue.overdue? && !issue.closed?}", title: _('Due date') }
             &nbsp;
             = sprite_icon('calendar')
-            = issue.due_date.to_s(:medium)
+            = issue.due_date.to_fs(:medium)
 
         = render_if_exists "projects/issues/issue_weight", issue: issue
         = render_if_exists "projects/issues/health_status", issue: issue
diff --git a/app/views/shared/deploy_tokens/_table.html.haml b/app/views/shared/deploy_tokens/_table.html.haml
index a7bf3bfb81e65..3827ecf73a47a 100644
--- a/app/views/shared/deploy_tokens/_table.html.haml
+++ b/app/views/shared/deploy_tokens/_table.html.haml
@@ -16,7 +16,7 @@
           %tr
             %td= token.name
             %td= token.username
-            %td= token.created_at.to_date.to_s(:medium)
+            %td= token.created_at.to_date.to_fs(:medium)
             %td
               - if token.expires?
                 %span{ class: ('text-warning' if token.expires_soon?) }
diff --git a/app/views/shared/members/_member.html.haml b/app/views/shared/members/_member.html.haml
index 376e51a6b1556..c86993f5b776b 100644
--- a/app/views/shared/members/_member.html.haml
+++ b/app/views/shared/members/_member.html.haml
@@ -43,7 +43,7 @@
             = _("Given access %{time_ago}").html_safe % { time_ago: time_ago_with_tooltip(member.created_at) }
           %span.js-expires-in{ class: ('gl-display-none' unless member.expires?) }
             &middot;
-            %span.js-expires-in-text{ class: "has-tooltip#{' text-warning' if member.expires_soon?}", title: (member.expires_at.to_time.in_time_zone.to_s(:medium) if member.expires?) }
+            %span.js-expires-in-text{ class: "has-tooltip#{' text-warning' if member.expires_soon?}", title: (member.expires_at.to_time.in_time_zone.to_fs(:medium) if member.expires?) }
               - if member.expires?
                 - preposition = current_user.time_display_relative ? '' : 'on'
                 = _("Expires %{preposition} %{expires_at}").html_safe % { expires_at: time_ago_with_tooltip(member.expires_at), preposition: preposition }
diff --git a/app/views/shared/milestones/_sidebar.html.haml b/app/views/shared/milestones/_sidebar.html.haml
index 5477b9395eabd..1b0eeb424c208 100644
--- a/app/views/shared/milestones/_sidebar.html.haml
+++ b/app/views/shared/milestones/_sidebar.html.haml
@@ -26,7 +26,7 @@
       .value
         %span.value-content{ data: { qa_selector: 'start_date_content' } }
           - if milestone.start_date
-            %span.bold= milestone.start_date.to_s(:medium)
+            %span.bold= milestone.start_date.to_fs(:medium)
           - else
             %span.no-value= s_('MilestoneSidebar|No start date')
 
@@ -63,7 +63,7 @@
       .value.hide-collapsed
         %span.value-content{ data: { qa_selector: 'due_date_content' } }
           - if milestone.due_date
-            %span.bold= milestone.due_date.to_s(:medium)
+            %span.bold= milestone.due_date.to_fs(:medium)
           - else
             %span.no-value= s_('MilestoneSidebar|No due date')
         - remaining_days = remaining_days_in_words(milestone.due_date, milestone.start_date)
diff --git a/app/views/users/calendar_activities.html.haml b/app/views/users/calendar_activities.html.haml
index 3571031fbfa51..e98dd87a3075c 100644
--- a/app/views/users/calendar_activities.html.haml
+++ b/app/views/users/calendar_activities.html.haml
@@ -1,5 +1,5 @@
 %h4.prepend-top-20
-  = html_escape(_("Contributions for %{calendar_date}")) % { calendar_date: tag.strong(@calendar_date.to_s(:medium)) }
+  = html_escape(_("Contributions for %{calendar_date}")) % { calendar_date: tag.strong(@calendar_date.to_fs(:medium)) }
 
 - if @events.any?
   %ul.bordered-list
diff --git a/doc/development/testing_guide/best_practices.md b/doc/development/testing_guide/best_practices.md
index 210da1799ccee..f4829a1e23974 100644
--- a/doc/development/testing_guide/best_practices.md
+++ b/doc/development/testing_guide/best_practices.md
@@ -1575,7 +1575,7 @@ Helpers should follow the Rails naming / namespacing convention, where
 module Features
   module IterationHelpers
     def iteration_period(iteration)
-      "#{iteration.start_date.to_s(:medium)} - #{iteration.due_date.to_s(:medium)}"
+      "#{iteration.start_date.to_fs(:medium)} - #{iteration.due_date.to_fs(:medium)}"
     end
   end
 end
diff --git a/ee/app/models/iteration.rb b/ee/app/models/iteration.rb
index 8c47f25d671c7..130a034f70209 100644
--- a/ee/app/models/iteration.rb
+++ b/ee/app/models/iteration.rb
@@ -177,7 +177,7 @@ def contains_digits?(query)
   end
 
   def period
-    "#{start_date.to_s(:medium)} - #{due_date.to_s(:medium)}"
+    "#{start_date.to_fs(:medium)} - #{due_date.to_fs(:medium)}"
   end
 
   def display_text
diff --git a/ee/app/presenters/epic_presenter.rb b/ee/app/presenters/epic_presenter.rb
index fbb94b644b394..f6524c37c7cb3 100644
--- a/ee/app/presenters/epic_presenter.rb
+++ b/ee/app/presenters/epic_presenter.rb
@@ -139,7 +139,7 @@ def epic_ancestors(epics)
         title: epic.title,
         url: url_builder.epic_path(epic),
         state: epic.state,
-        human_readable_end_date: epic.end_date&.to_s(:medium),
+        human_readable_end_date: epic.end_date&.to_fs(:medium),
         human_readable_timestamp: remaining_days_in_words(epic.end_date, epic.start_date)
       }
     end
diff --git a/ee/app/serializers/epic_base_entity.rb b/ee/app/serializers/epic_base_entity.rb
index de8c0bfd9751d..02a7310f2aa3c 100644
--- a/ee/app/serializers/epic_base_entity.rb
+++ b/ee/app/serializers/epic_base_entity.rb
@@ -12,7 +12,7 @@ class EpicBaseEntity < Grape::Entity
   end
   expose :group_id
   expose :human_readable_end_date, if: -> (epic, _) { epic.end_date.present? } do |epic|
-    epic.end_date&.to_s(:medium)
+    epic.end_date&.to_fs(:medium)
   end
   expose :human_readable_timestamp, if: -> (epic, _) { epic.end_date.present? || epic.start_date.present? } do |epic|
     remaining_days_in_words(epic.end_date, epic.start_date)
diff --git a/ee/app/views/admin/users/_credit_card_info.html.haml b/ee/app/views/admin/users/_credit_card_info.html.haml
index 6c0c4eeaa7739..e5239672341be 100644
--- a/ee/app/views/admin/users/_credit_card_info.html.haml
+++ b/ee/app/views/admin/users/_credit_card_info.html.haml
@@ -16,7 +16,7 @@
         - else
           %span.light= _('Validated at:')
           %strong
-            = credit_card_validation.credit_card_validated_at.to_s(:medium)
+            = credit_card_validation.credit_card_validated_at.to_fs(:medium)
 
       - if credit_card_validation&.holder_name
         %li
diff --git a/ee/app/views/admin/users/card_match.html.haml b/ee/app/views/admin/users/card_match.html.haml
index a21f77fc85189..11430af05ef24 100644
--- a/ee/app/views/admin/users/card_match.html.haml
+++ b/ee/app/views/admin/users/card_match.html.haml
@@ -36,10 +36,10 @@
             %td
               = credit_card_validation.holder_name
             %td.gl-text-right
-              = validated_at.to_s(:medium)
+              = validated_at.to_fs(:medium)
               \/
               = validated_at.in_time_zone(stripe_time_zone).strftime(stripe_time_format)
-            %td.gl-text-right= user.created_at.to_s(:medium)
+            %td.gl-text-right= user.created_at.to_fs(:medium)
             %td.gl-text-right
               - if user.current_sign_in_ip
                 = user.current_sign_in_ip
diff --git a/ee/app/views/credentials_inventory_mailer/personal_access_token_revoked_email.html.haml b/ee/app/views/credentials_inventory_mailer/personal_access_token_revoked_email.html.haml
index e215844a0ee61..16d9e763e98be 100644
--- a/ee/app/views/credentials_inventory_mailer/personal_access_token_revoked_email.html.haml
+++ b/ee/app/views/credentials_inventory_mailer/personal_access_token_revoked_email.html.haml
@@ -5,7 +5,7 @@
   %li
     = @token.name
   %li
-    = _("Created on %{created_at}") % { created_at: @token.created_at.to_date.to_s(:medium) }
+    = _("Created on %{created_at}") % { created_at: @token.created_at.to_date.to_fs(:medium) }
   - if @token.last_used_at
     %li
       = _("Last used %{last_used_at} ago") % { last_used_at: time_ago_in_words(@token.last_used_at) }
diff --git a/ee/app/views/credentials_inventory_mailer/personal_access_token_revoked_email.text.haml b/ee/app/views/credentials_inventory_mailer/personal_access_token_revoked_email.text.haml
index 4311ec85ec6ae..84b72f1415a64 100644
--- a/ee/app/views/credentials_inventory_mailer/personal_access_token_revoked_email.text.haml
+++ b/ee/app/views/credentials_inventory_mailer/personal_access_token_revoked_email.text.haml
@@ -2,7 +2,7 @@
 
 = @token.name
 
-= _("Created on %{created_at}") % { created_at: @token.created_at.to_date.to_s(:medium) }
+= _("Created on %{created_at}") % { created_at: @token.created_at.to_date.to_fs(:medium) }
 
 - if @token.last_used_at
   = _("Last used %{last_used_at} ago") % { last_used_at: time_ago_in_words(@token.last_used_at) }
diff --git a/ee/app/views/credentials_inventory_mailer/ssh_key_deleted_email.html.haml b/ee/app/views/credentials_inventory_mailer/ssh_key_deleted_email.html.haml
index 0f149fa20fbae..0ab2935455bd1 100644
--- a/ee/app/views/credentials_inventory_mailer/ssh_key_deleted_email.html.haml
+++ b/ee/app/views/credentials_inventory_mailer/ssh_key_deleted_email.html.haml
@@ -5,7 +5,7 @@
   %li
     = @params[:title]
   %li
-    = _("Created on %{created_at}") % { created_at: @params[:created_at].to_date.to_s(:medium) }
+    = _("Created on %{created_at}") % { created_at: @params[:created_at].to_date.to_fs(:medium) }
   - if @params[:last_used_at]
     %li
       = _("Last used %{last_used_at} ago") % { last_used_at: time_ago_in_words(@params[:last_used_at]) }
diff --git a/ee/app/views/credentials_inventory_mailer/ssh_key_deleted_email.text.haml b/ee/app/views/credentials_inventory_mailer/ssh_key_deleted_email.text.haml
index 1b31d4e3b0432..13bab44b668b6 100644
--- a/ee/app/views/credentials_inventory_mailer/ssh_key_deleted_email.text.haml
+++ b/ee/app/views/credentials_inventory_mailer/ssh_key_deleted_email.text.haml
@@ -2,7 +2,7 @@
 
 = @params[:title]
 
-= _("Created on %{created_at}") % { created_at: @params[:created_at].to_date.to_s(:medium) }
+= _("Created on %{created_at}") % { created_at: @params[:created_at].to_date.to_fs(:medium) }
 
 - if @params[:last_used_at]
   = _("Last used %{last_used_at} ago") % { last_used_at: time_ago_in_words(@params[:last_used_at]) }
diff --git a/ee/app/views/shared/billings/_eoa_bronze_plan_banner.html.haml b/ee/app/views/shared/billings/_eoa_bronze_plan_banner.html.haml
index cef0787e71ebf..ecf01286d992c 100644
--- a/ee/app/views/shared/billings/_eoa_bronze_plan_banner.html.haml
+++ b/ee/app/views/shared/billings/_eoa_bronze_plan_banner.html.haml
@@ -6,4 +6,4 @@
                                dismiss_endpoint: callouts_path }}) do |c|
       - c.with_body do
         - announcement_link = external_link("announcement blog", "https://about.gitlab.com/blog/2021/01/26/new-gitlab-product-subscription-model")
-        = s_("BillingPlans|While GitLab is ending availability of the Bronze plan, you can still renew your Bronze subscription one additional time before %{eoa_bronze_plan_end_date}. We are also offering a limited time free upgrade to our Premium Plan (up to 25 users)! Learn more about the changes and offers in our %{announcement_link}.").html_safe % { announcement_link: announcement_link, eoa_bronze_plan_end_date: eoa_bronze_plan_end_date.in_time_zone.to_date.to_s(:medium) }
+        = s_("BillingPlans|While GitLab is ending availability of the Bronze plan, you can still renew your Bronze subscription one additional time before %{eoa_bronze_plan_end_date}. We are also offering a limited time free upgrade to our Premium Plan (up to 25 users)! Learn more about the changes and offers in our %{announcement_link}.").html_safe % { announcement_link: announcement_link, eoa_bronze_plan_end_date: eoa_bronze_plan_end_date.in_time_zone.to_date.to_fs(:medium) }
diff --git a/ee/spec/mailers/credentials_inventory_mailer_spec.rb b/ee/spec/mailers/credentials_inventory_mailer_spec.rb
index 7c89935b9e23c..a288a9ce0ab54 100644
--- a/ee/spec/mailers/credentials_inventory_mailer_spec.rb
+++ b/ee/spec/mailers/credentials_inventory_mailer_spec.rb
@@ -15,7 +15,7 @@
     it { is_expected.to have_subject 'Your Personal Access Token was revoked' }
     it { is_expected.to have_body_text 'The following Personal Access Token was revoked by an administrator, Revoker' }
     it { is_expected.to have_body_text token.name }
-    it { is_expected.to have_body_text "Created on #{token.created_at.to_date.to_s(:medium)}" }
+    it { is_expected.to have_body_text "Created on #{token.created_at.to_date.to_fs(:medium)}" }
     it { is_expected.to have_body_text 'Scopes: api, sudo' }
     it { is_expected.to be_delivered_to [token.user.notification_email_or_default] }
     it { is_expected.to have_body_text 'Last used 21 days ago' }
@@ -39,7 +39,7 @@
     it { is_expected.to have_body_text 'The following SSH key was deleted by an administrator, Revoker' }
     it { is_expected.to be_delivered_to [ssh_key.user.notification_email_or_default] }
     it { is_expected.to have_body_text ssh_key.title }
-    it { is_expected.to have_body_text "Created on #{ssh_key.created_at.to_date.to_s(:medium)}" }
+    it { is_expected.to have_body_text "Created on #{ssh_key.created_at.to_date.to_fs(:medium)}" }
     it { is_expected.to have_body_text 'Last used 21 days ago' }
   end
 end
diff --git a/spec/controllers/groups/group_members_controller_spec.rb b/spec/controllers/groups/group_members_controller_spec.rb
index fe4b80e12fead..feebdd972aa7f 100644
--- a/spec/controllers/groups/group_members_controller_spec.rb
+++ b/spec/controllers/groups/group_members_controller_spec.rb
@@ -234,7 +234,7 @@
         it 'returns correct json response' do
           expect(json_response).to eq({
             "expires_soon" => false,
-            "expires_at_formatted" => expiry_date.to_time.in_time_zone.to_s(:medium)
+            "expires_at_formatted" => expiry_date.to_time.in_time_zone.to_fs(:medium)
           })
         end
       end
diff --git a/spec/controllers/projects/project_members_controller_spec.rb b/spec/controllers/projects/project_members_controller_spec.rb
index ad49529b4262a..9657cf33afd87 100644
--- a/spec/controllers/projects/project_members_controller_spec.rb
+++ b/spec/controllers/projects/project_members_controller_spec.rb
@@ -320,7 +320,7 @@
           it 'returns correct json response' do
             expect(json_response).to eq({
               "expires_soon" => false,
-              "expires_at_formatted" => expiry_date.to_time.in_time_zone.to_s(:medium)
+              "expires_at_formatted" => expiry_date.to_time.in_time_zone.to_fs(:medium)
             })
           end
         end
diff --git a/spec/features/issues/user_creates_issue_spec.rb b/spec/features/issues/user_creates_issue_spec.rb
index d4148717f0a64..57183b2e8d91d 100644
--- a/spec/features/issues/user_creates_issue_spec.rb
+++ b/spec/features/issues/user_creates_issue_spec.rb
@@ -159,7 +159,7 @@
         click_button 'Create issue'
 
         page.within '.issuable-sidebar' do
-          expect(page).to have_content date.to_s(:medium)
+          expect(page).to have_content date.to_fs(:medium)
         end
       end
     end
diff --git a/spec/features/issues/user_edits_issue_spec.rb b/spec/features/issues/user_edits_issue_spec.rb
index 7e54580b0851b..47c532c396313 100644
--- a/spec/features/issues/user_edits_issue_spec.rb
+++ b/spec/features/issues/user_edits_issue_spec.rb
@@ -82,7 +82,7 @@
           click_button _('Save changes')
 
           page.within '.issuable-sidebar' do
-            expect(page).to have_content date.to_s(:medium)
+            expect(page).to have_content date.to_fs(:medium)
           end
         end
 
diff --git a/spec/features/merge_request/user_sees_deployment_widget_spec.rb b/spec/features/merge_request/user_sees_deployment_widget_spec.rb
index 44660b247a163..d237faba66381 100644
--- a/spec/features/merge_request/user_sees_deployment_widget_spec.rb
+++ b/spec/features/merge_request/user_sees_deployment_widget_spec.rb
@@ -39,7 +39,7 @@ def assert_env_widget(text, env_name)
         wait_for_requests
 
         assert_env_widget("Deployed to", environment.name)
-        expect(find('.js-deploy-time')['title']).to eq(deployment.created_at.to_time.in_time_zone.to_s(:medium))
+        expect(find('.js-deploy-time')['title']).to eq(deployment.created_at.to_time.in_time_zone.to_fs(:medium))
       end
 
       context 'when a user created a new merge request with the same SHA' do
diff --git a/spec/services/quick_actions/interpret_service_spec.rb b/spec/services/quick_actions/interpret_service_spec.rb
index bd09dae0a5a74..fd614fba091e5 100644
--- a/spec/services/quick_actions/interpret_service_spec.rb
+++ b/spec/services/quick_actions/interpret_service_spec.rb
@@ -301,7 +301,7 @@
       it 'returns due_date message: Date.new(2016, 8, 28) if content contains /due 2016-08-28' do
         _, _, message = service.execute(content, issuable)
 
-        expect(message).to eq("Set the due date to #{expected_date.to_s(:medium)}.")
+        expect(message).to eq("Set the due date to #{expected_date.to_fs(:medium)}.")
       end
     end
 
diff --git a/spec/support/helpers/features/iteration_helpers.rb b/spec/support/helpers/features/iteration_helpers.rb
index fab373a547f10..7ae546fb83c19 100644
--- a/spec/support/helpers/features/iteration_helpers.rb
+++ b/spec/support/helpers/features/iteration_helpers.rb
@@ -3,7 +3,7 @@
 module Features
   module IterationHelpers
     def iteration_period(iteration)
-      "#{iteration.start_date.to_s(:medium)} - #{iteration.due_date.to_s(:medium)}"
+      "#{iteration.start_date.to_fs(:medium)} - #{iteration.due_date.to_fs(:medium)}"
     end
   end
 end
diff --git a/spec/support/shared_examples/features/sidebar/sidebar_due_date_shared_examples.rb b/spec/support/shared_examples/features/sidebar/sidebar_due_date_shared_examples.rb
index 206116d66c8fe..865f5aff476ab 100644
--- a/spec/support/shared_examples/features/sidebar/sidebar_due_date_shared_examples.rb
+++ b/spec/support/shared_examples/features/sidebar/sidebar_due_date_shared_examples.rb
@@ -26,7 +26,7 @@
 
         wait_for_requests
 
-        expect(page).to have_content(today.to_s(:medium))
+        expect(page).to have_content(today.to_fs(:medium))
         expect(due_date_value.text).to have_content Time.current.strftime('%b %-d, %Y')
       end
     end
-- 
GitLab