Skip to content

Rails 7 deprecates Date#to_s in favor of Date#to_formatted_s#774

Merged
adrianthedev merged 1 commit into
avo-hq:mainfrom
rickychilcott:fix/deprecation-warning-on-using-to-s-on-dates
Apr 2, 2022
Merged

Rails 7 deprecates Date#to_s in favor of Date#to_formatted_s#774
adrianthedev merged 1 commit into
avo-hq:mainfrom
rickychilcott:fix/deprecation-warning-on-using-to-s-on-dates

Conversation

@rickychilcott
Copy link
Copy Markdown
Contributor

Description

This fixes a deprecation warning in Rails 7 where dates should be formatted using to_formatted_s when passing a named format type.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works

Manual review steps

Tried in my existing app and everything seems fine. to_s simply forwarded to to_formatted_s, so it's a benign change.

@qlty-cloud-legacy
Copy link
Copy Markdown

Code Climate has analyzed commit 9134252 and detected 0 issues on this pull request.

View more on Code Climate.

@rickychilcott
Copy link
Copy Markdown
Contributor Author

If this is merged. Any chance it can get backported to a 1.x release? I'm planning to upgrade to 2.x soon-ish, but I'm trying to get to Rails 7 in my app first.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 2, 2022

Codecov Report

Merging #774 (9134252) into main (90cc721) will not change coverage.
The diff coverage is 0.00%.

@@           Coverage Diff           @@
##             main     #774   +/-   ##
=======================================
  Coverage   94.08%   94.08%           
=======================================
  Files         430      430           
  Lines        7861     7861           
=======================================
  Hits         7396     7396           
  Misses        465      465           
Impacted Files Coverage Δ
lib/avo/fields/date_field.rb 94.44% <0.00%> (ø)
spec/system/avo/default_field_spec.rb 95.12% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 90cc721...9134252. Read the comment docs.

@adrianthedev adrianthedev merged commit 11c4747 into avo-hq:main Apr 2, 2022
@adrianthedev
Copy link
Copy Markdown
Collaborator

Thanks @rickychilcott.
Do you mind branching from '1.x' and creating a PR for '1.x' to add this fix?

I'll cut a release after we merge it.

@rickychilcott
Copy link
Copy Markdown
Contributor Author

attempted in #775

Thanks!

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