Our workflow processes have an "effective date" that is set by the initiator when they submit the initial form that creates a workflow job. The last node in the process is a system task that saves the form's data to the database, and the second-to-last node is a pause node that runs every hour to check if the effective date has been reached. Since it runs every hour, this pause node would be completed sometime between midnight-1am on the effective date.
Recently, we noticed that rather than being completed between midnight and 1am as expected, pause nodes were instead being completed on the night before, between 7 and 8pm, or 5 hours ahead of schedule. We're in the EST timezone which is GMT-5 right now, so I figured this was some kind of timezone-related issue, and I started looking into it.
Before going further, I need to mention that we've added a few fields to the included Workflow Administration form to help us filter jobs. Notably for this issue is the Form Creation To/From date fields:
On Feb 18th, I created a test job at 8:52pm to troubleshoot the issue. When I went to the Workflow Admin to see it there, I noticed it didn't appear when I filtered for jobs created on the 18th:
However, it does appear if I filter for jobs started on the 19th:
I've logged the js Date objects that are being passed to the getFilteredJobs() function, as well as the values for job.getCreationDate(), and I get this, which is what I would expect:
Code: Select all
Mon Feb 22 17:28:16: INFO fromDate : Fri Feb 19 2021 00:00:00 GMT-0500 (EST) Mon Feb 22 17:28:16: INFO toDate : Fri Feb 19 2021 00:00:00 GMT-0500 (EST) Mon Feb 22 17:28:16: INFO Thu Feb 18 2021 20:52:36 GMT-0500 (EST) Mon Feb 22 17:28:16: INFO Fri Feb 19 2021 15:07:46 GMT-0500 (EST)
This is the code that gets the values from the date filter fields and retrieves the jobs:
Code: Select all
var fromDate; fromDate = new Date(fields.JOB_CREATED_FROM.value); log("fromDate : "+ fromDate); var toDate; toDate = new Date(fields.JOB_CREATED_TO.value); log("toDate : "+ toDate); var jobs = api.getFilteredJobs(jobId, null, null, null, finishedJobs, fromDate, toDate, null, null, procAttr, true, false, form.language, system.securityManager.getUserName());