I have the following code being run by a cron job to create a ticket every Tuesday at 11am (Australia/Melbourne) with a due date of Wednesday at 11am (also Australia/Melbourne, so 24 hours later):
use RT (); use RT::Date (); use RT::Interface::CLI (); use RT::Ticket (); RT::Interface::CLI::CleanEnv; RT::LoadConfig; RT::Init; my $due_date = RT::Date->new($RT::SystemUser); $due_date->Set( Value => '11am Wednesday', Format => 'unknown', ); my $ticket = RT::Ticket->new($RT::SystemUser); $ticket->Create( Queue => '<queue name>', Subject => '<ticket title>', Due => $due_date, ); The ticket is created at 11am Tuesday (as expected), with a Due time of 11am Tuesday (not expected--should be 11am Wednesday). What am I doing wrong? It looks like something could be wrong in the way RT::Date calls Time::ParseDate: $ grep '11am Wednesday' rt-debug.log ... [debug]: RT::Date used Time::ParseDate to make '11am Wednesday' 1402362000 (.../RT/Date.pm:240) $ TZ=Australia/Melbourne perl -e 'warn scalar localtime(1402362000)' Tue Jun 10 11:00:00 2014 at -e line 1. I'm running RT v4.2.3 at the moment with the latest version of Time::ParseDate at this time (v2013.1113). RT configuration variable $Timezone is set to 'Australia/Melbourne'. For what it's worth, the server running the cron job has its timezone set to 'America/Los_Angeles', but as the cron job fires at the correct time, I don't think this contributes to the problem.
-- RT Training - Boston, September 9-10 http://bestpractical.com/training