Report.reported_date+1 meaning


I am wondering about this one, this is on our code before, can someone explain me this line?
“report.reported_date+1” means ?

        name: '',
        icon: 'icon-family',
        title: 'task.screening.adulthood.title',
        appliesTo: 'reports',
        appliesToType: ['screening_adulthood'],
        appliesIf: function (contact) {
            return !isMuted(contact) && isCHC() &&
       === 'household_member' &&
                getAgeInYears(>=13 && getAgeInYears(<49;        //changed from 12 to 13

        resolvedIf: (contact, report, event, dueDate) => {
            return Utils.isFormSubmittedInWindow(
                report.reported_date + 1,
                Utils.addDate(dueDate, event.end + 1).getTime()

        actions: [
                type: 'report',
                form: 'screening_adulthood',
                label: 'Screening'
        events: [{
            id: 'screening',
            start: 335,  // (15)
            end: 180,   // (180)
            days: 365  //(60)


Hi @Marcelo_De_Guzman,

In the code snippet you provided, the line report.reported_date + 1 is part of a function called resolvedIf, which determines whether the task resolving condition is met.

In CHT, user-generated documents (contacts and reports) have reported_date which is a numerical value equal to the number of seconds that have elapsed since the Unix epoch (00:00:00 UTC on 1 January 1970).

So, report.reported_date + 1 means that the code is adding 1 millisecond to the reported date of the report that triggered this task. The purpose of this addition is to create a window of time that starts one millisecond after the reported date. It’s used to check if a certain form or action has been submitted within a specific time frame relative to the reported date. This could be a way to ensure that a certain action or form submission occurs within a particular timeframe after the report’s date.

In your case, both the source report (that triggered the task) and the action report (that the task will take you to) are of the same form i.e. screening_adulthood. So it’s important to ensure that the source report itself does not resolve the task it created.

cht-conf version 3.7.0 and above have a default resolving condition. If you skip the resolvedIf function from your task definition, the default resolving condition will still apply which looks almost similar to how your resolving condition works. However, please test thoroughly that your tasks work correctly if you decide to remove it.

So, for this example, when the report has been submitted and converted to a date like “1693390894151” + 1, is just means after it was submitted, it will gonna trigger again , is that right?

After it is submitted, the first task should be resolved.
A second task should be created with the due date after 180 days.

If there was no reported_date + 1 in the code:

  1. User submits a screening report
  2. Task is created
  3. Task is resolved immediately because it finds the report created at step 1

The +1 done here is just for checking the resolve condition. The actual reported_date of the report is not changed by it.