Skip to content

Commit

Permalink
Merge pull request #115 from sapiensfio/fix-114
Browse files Browse the repository at this point in the history
Solved issue #114 where a job's StartAfter date was always being save…
  • Loading branch information
nyeholt authored Feb 16, 2017
2 parents f17a1b9 + d375eea commit a4add19
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions code/controllers/QueuedJobsAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ class QueuedJobsAdmin extends ModelAdmin {
'EditForm'
);

/**
* European date format
* @var string
*/
private static $date_format_european = 'dd/MM/yyyy';

/**
* @var QueuedJobService
*/
Expand Down Expand Up @@ -134,6 +140,12 @@ public function createjob($data, Form $form) {
$js = $form->Fields()->dataFieldByName('JobStart');
$time = $js->Value();

// If the user has select the European date format as their setting then replace '/' with '-' in the date string so PHP
// treats the date as this format.
if (Member::currentUser()->DateFormat == self::$date_format_european) {
$time = str_replace('/', '-', $time);
}

if ($jobType && class_exists($jobType)) {
$jobClass = new ReflectionClass($jobType);
$job = $jobClass->newInstanceArgs($params);
Expand Down

0 comments on commit a4add19

Please sign in to comment.