Search for records Filter by Current Date not working

This bug is similar to this one, but instead is not working when trying to:

Search for record > Where > Date (Field) > Is > Current date (without adding or subtracting dates).

The search will not collect records that are from the current date. It also does not work when trying to use filter collected records.

It does however filter correctly in the conditional action filters.

I encounter this issue again.

This is not finding the records in “Site Management” that are “Current date” when a matching record exists.

I’m looking for script workarounds at the moment

I came up with the script solution. Will post it here for future reference.

Reason for this:
I need to search App B for one record with a Date field that equals the current date. App B is used as a “review before making an API call” to deploy to Cloudflare Worker.

If there are no records with a matching date, then it should create a new record with the current date and add the record from App A to the relation field of App B. If there is a matching record in App B (same date as the current date), then it adds the new record to the relation field in App B.

Here is how I accomplish that with scripts, since the “Search for records” bug is not finding the date:

1. Use getManyFiltered script

const result = await tape.Record.getManyFiltered({
    appId: {{App-B-appid),
    limit: 1,
    filters: [
        {
            "field_id": "{{Date_field_id}}",
            "field_type": "single_date",
            "match_type": "equal",
            "relative_date_type": "exact_date",
            "values": [{ "value": { "date": current_datetime_local } }],
            "type": "date"
        }

    ]
}
);

var_collectedrecordid = jsonata('data.records[0].record_id').evaluate(result);
var_existingrecordids = await jsonata('data.records.fields[external_id="{{related_field_external_id}}"].values.value.record_id').evaluate(result);

const searchDate = jsonata('data.records[0].fields[external_id="date"].values[0].start_date').evaluate(result);
var_equaldates = searchDate === current_date_local

2. Create a conditional action and activate “Turn into script filter”

Here we evaluate var_equaldates === false. When the dates are not equal, it means there is no record on App B, so we use the Create a Record automation to create it.

3. When Dates match

Here we evaluate var_equaldates === true (you can also use the “Else statement” in the previous conditional if you like). When the dates are equal, it means a record exists on App B, so we need to update it. Because the “Search for Record” was not triggered due to the bug, we cannot use the “Update collected” automation; we need to update the record in App B with a script.

await tape.Record.update(var_collectedrecordid, {
    "fields": {
        "related_blogs": [var_existingrecordids,current_record_id]
    },
    silent: true
}
);

var_collectedrecordid is the matching record that we need to update
var_existingrecordids will have the related record IDs “attached” to the relation field in App B. To not overwrite what we have, we need to include the old id’s and new record id’s (var_existingrecordids,current_record_id).