私のデータベースの日付は次のようになります。2012-07-23
日付が 7 日前より古く 14 日未満であるかどうか、または日付が 14 日前よりも大きいかどうかを確認しようとしていますが、うまくいきません..
これが私のコードです:
def progress_report_status_check(date)
progress_date = date.to_date
seven_days = 7.days.ago.to_date
fourteen_days = 14.days.ago.to_date
if seven_days > (progress_date - 7.days.ago.to_date) or (progress_date - 14.days.ago.to_date) < fourteen_days
"due"
elsif (progress_date - 14.days.ago.to_date) > fourteen_days
"overdue"
end
end