javan/whenever

Incorrect crontab generated when using "days after/before"

alecvn opened this issue · 0 comments

Chronic correctly parses the following:

> Chronic.parse('4 days after start of month at 1pm')
=> 2021-10-05 13:00:00 +0200

However, the crontab the following generates:

every 1.month, at: '4 days after start of month at 1pm' do
  rake "execute_some_task"
end

Is incorrect:

0 13 1 * * /bin/bash -l -c 'cd /home/path/to/project && RAILS_ENV=development bundle exec rake execute_some_task --silent'

As it schedules the job for the 1st day of every month instead.

  • This example is just to simplify the issue for illustrative purposes, in reality I'm attempting to have the job run 4 days before the end of the month, but that comes with its own nuances.