Skip to content

Commit

Permalink
Merge branch 'feature-PRESIDECMS-2983_bad-next-run-date' into hotfix-…
Browse files Browse the repository at this point in the history
…10.27.25
  • Loading branch information
DominicWatson committed Dec 10, 2024
2 parents ba39bae + 2b0c9bd commit a15b7d4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion system/services/taskmanager/CronUtil.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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;
}

}
4 changes: 2 additions & 2 deletions tests/unit/api/taskmanager/TaskManagerServiceTest.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -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(){
Expand Down Expand Up @@ -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(){
Expand Down

0 comments on commit a15b7d4

Please sign in to comment.