diff --git a/system/services/taskmanager/CronUtil.cfc b/system/services/taskmanager/CronUtil.cfc index e10abd538..e4d984c22 100644 --- a/system/services/taskmanager/CronUtil.cfc +++ b/system/services/taskmanager/CronUtil.cfc @@ -29,7 +29,7 @@ component displayName="Cron util" { var cronTabExpression = _getCrontabExpressionObject( arguments.crontabExpression ); var executionTimeObj = CreateObject( "java", "com.cronutils.model.time.ExecutionTime", _getLib() ).forCron( cronTabExpression ); - return executionTimeObj.nextExecution( _createJavaZonedTimeObject( arguments.lastRun ) ).get().toString(); + return executionTimeObj.nextExecution( _createJavaZonedTimeObject( arguments.lastRun ) ).get().format( variables._dateTimeFormat ); } public string function describeCronTabExression( required string crontabExpression, required string locale ) { @@ -94,6 +94,7 @@ component displayName="Cron util" { if ( Left( variables._timezoneOffset, "1" ) != "-" ) { variables._timezoneOffset = "+" & variables._timezoneOffset; } + variables._dateTimeFormat = CreateObject( "java", "java.time.format.DateTimeFormatter" ).ISO_LOCAL_DATE_TIME; } } \ No newline at end of file diff --git a/tests/unit/api/taskmanager/TaskManagerServiceTest.cfc b/tests/unit/api/taskmanager/TaskManagerServiceTest.cfc index 61f7e0f27..f313e456e 100644 --- a/tests/unit/api/taskmanager/TaskManagerServiceTest.cfc +++ b/tests/unit/api/taskmanager/TaskManagerServiceTest.cfc @@ -312,7 +312,7 @@ component extends="testbox.system.BaseSpec" { var nextRun = tm.getNextRunDate( taskKey, lastRun ); - expect( nextRun ).toBe( "2014-10-24T09:05Z" ); + expect( nextRun ).toBe( "2014-10-24T09:05:00" ); } ); it( "shoud use the current date when no last run date passed", function(){ @@ -342,7 +342,7 @@ component extends="testbox.system.BaseSpec" { var nextRun = tm.getNextRunDate( taskKey, lastRun ); - expect( nextRun ).toBe( "2014-10-24T09:10Z" ); + expect( nextRun ).toBe( "2014-10-24T09:10:00" ); } ); it( "should return an empty string when task is not a scheduled task", function(){