Skip to content

Fix DEPRECATION WARNING: TimeWithZone#to_s(:short)#528

Closed
iainbeeston wants to merge 1 commit intoice-cube-ruby:masterfrom
iainbeeston:remove-deprecation-warnings
Closed

Fix DEPRECATION WARNING: TimeWithZone#to_s(:short)#528
iainbeeston wants to merge 1 commit intoice-cube-ruby:masterfrom
iainbeeston:remove-deprecation-warnings

Conversation

@iainbeeston
Copy link
Copy Markdown

Rails has deprecated passing a parameter to to_s and
now expects to_formatted_s to be used instead.

This is the full error I see:

DEPRECATION WARNING: TimeWithZone#to_s(:short) is deprecated. Please use TimeWithZone#to_fs(:short) instead. (called from to_s at /ice-cube-ruby/ice_cube/lib/ice_cube/occurrence.rb:89)

Rails has deprecated passing a parameter to `to_s` and
now expects `to_formatted_s` to be used instead.

This is the full error I see:

    DEPRECATION WARNING: TimeWithZone#to_s(:short) is deprecated. Please use TimeWithZone#to_fs(:short) instead. (called from to_s at /ice-cube-ruby/ice_cube/lib/ice_cube/occurrence.rb:89)
@adfoster-r7
Copy link
Copy Markdown

Looks like this is now an error in newer versions of Active Support:

Failures:

  1) IceCube::Occurrence to_s accepts a format option to comply with ActiveSupport
     Failure/Error: expect(occurrence.to_s(:short)).to eq time_now.to_s(:short)
     
     ArgumentError:
       wrong number of arguments (given 1, expected 0)
     # /Users/user/.rvm/gems/ruby-3.0.2@pro/gems/activesupport-7.1.3/lib/active_support/time_with_zone.rb:200:in `to_s'
     # ./spec/examples/occurrence_spec.rb:31:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:76:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:75:in `block (2 levels) in <top (required)>'

After applying these changes locally, they pass though 👍

@pacso
Copy link
Copy Markdown
Collaborator

pacso commented May 9, 2026

Fixed in #449

@pacso pacso closed this May 9, 2026
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.

3 participants