Skip to content

Add support for localized date references#12822

Merged
carlosantoniodasilva merged 2 commits into
rails:masterfrom
cbartlett:master
Dec 3, 2013
Merged

Add support for localized date references#12822
carlosantoniodasilva merged 2 commits into
rails:masterfrom
cbartlett:master

Conversation

@cbartlett

Copy link
Copy Markdown
Contributor

Ruby's Date class automatically gives us #yesterday, #today, and #tomorrow. And ActiveSupport has a handy Time.zone.today for getting a localized version. But there was no localized version of #yesterday or #tomorrow.

This patch adds those methods.

Any thoughts on this? I think if we offer #today to mimic the behavior of Date, perhaps we should also offer #tomorrow and #yesterday? I ran into the problem when localizing an app and converting a bunch of Date.today and Date.tomorrow usages.

@senny

senny commented Nov 9, 2013

Copy link
Copy Markdown
Member

/cc @pixeltrix

Comment thread activesupport/test/time_zone_test.rb Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL. This was just following the convention of the method above. Should I update this test? And leave the rest of them, or change them all?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to change test_today too.

@pixeltrix

Copy link
Copy Markdown
Contributor

@cbartlett can you provide a CHANGELOG entry as well - thanks

@cbartlett

Copy link
Copy Markdown
Contributor Author

@pixeltrix CHANGELOG added.

Ruby's Date class automatically gives us #yesterday, #today,
and #tomorrow. And ActiveSupport has a handy Time.zone.today
for getting a localized version. But there was no localized
version of #yesterday or #tomorrow. Until now.
@cbartlett

Copy link
Copy Markdown
Contributor Author

@senny @carlosantoniodasilva All done. Test update to use travel_to, thanks!

@pftg

pftg commented Dec 3, 2013

Copy link
Copy Markdown
Contributor

@cbartlett please squash commits

@senny

senny commented Dec 3, 2013

Copy link
Copy Markdown
Member

@pftg first one is a refactoring of existing code. I think it's fine to keep them separated.

@cbartlett

Copy link
Copy Markdown
Contributor Author

@pftg I rebased all my related commits together before i pushed. The other commit wasn't related to my addition.

@carlosantoniodasilva

Copy link
Copy Markdown
Member

Looks good, thanks 👍

@pftg

pftg commented Dec 3, 2013

Copy link
Copy Markdown
Contributor

I see, sorry for worries

@cbartlett

Copy link
Copy Markdown
Contributor Author

@pftg ничего страшного)

carlosantoniodasilva added a commit that referenced this pull request Dec 3, 2013
Add support for localized date references
@carlosantoniodasilva carlosantoniodasilva merged commit 1441961 into rails:master Dec 3, 2013
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.

5 participants