Here’s my code:
item = []
today = Date.today
dates = {"3 years" => today << 12*3, "2 years" => today << 12*2,
"1.5 years" => today << 12*1.5,"1 year" => today << 12, "6 months" => today << 6,
"3 months" => today << 3, "today" => today}
I’m getting this error `<<': invalid date (ArgumentError) on the line that starts with dates... every time I run it.
What’s wrong? today should be a valid date, and I tried putting parenthesis around the multiplication, and around the value fields, but still that error. When I tried it in irb, it worked fine. Date is required at the top of the file.
This one is the culprit. Replace it by
"1.5 years" => today << 18, because the<<method is apparently not capable of handling floats (in 1.9.3).