Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

AO3-5229: Simple fix for ancient date errors #3190

Merged
merged 2 commits into from Dec 1, 2017

Conversation

Projects
None yet
4 participants
Owner

elzj commented Nov 30, 2017

Issue

https://otwarchive.atlassian.net/browse/AO3-5229

Purpose

Fix error encountered when a user enters a very large date in date search. Since we're really just concerned with things posted by contemporaneous people, a simple fix should suffice for now.

Testing

Entering a large value in date search should no longer error.

app/models/search.rb
def self.time_from_string(amount, period)
- amount.to_i.send(period).ago
+ date = amount.to_i.send(period).ago
+ date.year < 0 ? 1000.years.ago : date
@houndci-bot

houndci-bot Nov 30, 2017

Use date.year.negative? instead of date.year < 0.

Owner

sarken commented Dec 1, 2017

redsummernight gave the thumbs-up in chat, so merging!

@sarken sarken merged commit ed19127 into otwcode:master Dec 1, 2017

4 checks passed

Scrutinizer 1 new issues, 2 updated code elements
Details
codeclimate All good!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
hound No violations found. Woof!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment