Timezone causes error in DHIS2

Hi @taylordowns2000, we got this issue Sunday, April 30th on job 3:

"value": "Period: `202304` is after latest open future period: `202303` for data element: `R9iYL185FgN`",

From my understanding, I think this is caused because OpenFN and DHIS2 are operating on different timezones. If we’re in month x, then at the end of the month, OpenFN being on GMT, hits month x+1 before the DHIS2 server. As a result, it tries to push in data a month ahead of what DHIS2 is comfortable with and as a result is rejected.

I think changing the cron expression to this should fix the error:

15 4-23/1 * * *

What do you think?

@rickettspc @aissatoudiallo

Hey Clem! I like your intuition there… this kind of stuff can often come up.

In this case, however, is the “period” generated by OpenFn at all?

I’m pretty sure it’s actually generated by line 46 of this query: https://github.com/OpenFn/os4h-sluhis-dhis2/blob/main/jobs/1-getSluhisData.js#L46

Then are SLUHIS and DHIS2 using the same time zones?

Either way, I’d address this by changing the job code that generates and filters on these “periods” rather than changing the trigger.