myneid/Redmine-Periodic-Task — Issue #5: Next run date is calculated improperly
Author: shadowpanther
Created: 2011-12-01 13:32:45+00:00
State: open

Today is 2011-12-01. I have a task with next date set, say, to 2011-12-01 00:00:00.
When cron job runs at 01:00, next run time is set to something like 2012-01-01 01:00:30 (seconds depend on cron job run time). Then, because you are comparing next run date to today's date only (without time), next time this task actually runs is 2012-01-02, and next run time would be set to 2012-02-02 01:00:30 and so on.

The simple solution would be to do:
```task.next_run_date = interval.send(units.downcase).from_now.to_date```
in scheduled_tasks_checker.rb, converting DateTime to Date, so next run time for today's task would be set to 2012-01-01 00:00:00.