Background on Application.
Users write test's and their results expire after 5 years.
I need to give them the option to rewrite after 3 years up to 5 years.
I have the expiry_date which is set to 5 years from the date it got created.
My Question
How would I write my statement
I have the ActiveSupport gem
expiry_date is in Date format
if expiry_date < 3.years.ago && expiry_date > 5.years.ago
#Above is checking the date itself which is not right
What I'm trying to achieve.
expiry_date = Mon, 25 Mar 2024 #Was created on 25 Mar 2019 (Created_date not a field in db)
# Statement check's if it is past 3 years (from created) but less than 5 years(from created)
returns True
#Any where outside the range returns False
My thoughts
Would need to get today's date. Then see where it is in the 5 year time frame and whether it has been between 3 and 5 years.
It would need to be accurate to the day
Any help or advice would be appreciated.