[DONE] End Date not adding as expected

If I try to add the end date via automation it does not add it, the start adds fine:

I can put the end in by doing it this way:

const rID = jsonata('record_id').evaluate(record_collection_activities);
const response = await tape.Record.update(rID, {
    fields: {
        date: {
            start: var_start,
            end: var_end
        }
    }
});
console.log(JSON.stringify(response));

I think the error is here, were start_date is duplicated:

collected_activity_field_date_start_formatted = (record_collection_activities[0]?.fields.find((field) => field.field_id === 363556) ?? null)?.values[0] ? TapeUtils.formatDevApiDateValue(
        { start_date: (record_collection_activities[0]?.fields.find((field) => field.field_id === 363556) ?? null)?.values[0]?.start_date, start_time: (record_collection_activities[0]?.fields.find((field) => field.field_id === 363556) ?? null)?.values[0]?.start_time }
      ) : null;
collected_activity_field_date_end_formatted = (record_collection_activities[0]?.fields.find((field) => field.field_id === 363556) ?? null)?.values[0] ? TapeUtils.formatDevApiDateValue(
        { start_date: (record_collection_activities[0]?.fields.find((field) => field.field_id === 363556) ?? null)?.values[0]?.end_date, start_time: (record_collection_activities[0]?.fields.find((field) => field.field_id === 363556) ?? null)?.values[0]?.end_time }
      ) : null;
2 Likes

I can confirm this issue.

Also happening on our side.

Thanks for sharing, this is indeed an issue that I was able to reproduce. Currently, it is not possible to use the “CALCULATION” field assignment to set a range date field’s end date/time. As you stated, it always overrides the start date/time.

As a temporary workaround, and similar to what @Jason suggested, you can convert your action to code and adjust the code like so (you will need to replace the 45 with your field id, and var_start_date / var_end_date with your variable names):

const fields = {}; 
fields[45] = null; 

    {
      fields[45] = fields[45] = fields[45] ?  { ...fields[45], start: var_start_date } : {start: (var_start_date)};
    }

    {
      fields[45] = fields[45] = fields[45] ?  { ...fields[45], end: var_end_date } : {end: var_end_date};
    } 

// perform update
const { data: updatedRecord } = await tape.Record.update(record_id, { fields }); 

It will then properly update the end date/time.

We’re working on a fix that should be available on Monday, I’ll ping you here once it is live.

The team appreciates your patience and thanks to all of you for helping us to make Tape better every week! :sunglasses:

Cheers
Tim

1 Like

Another one fixed :slight_smile:

I can confirm the Tape team has fixed this now, many thanks

1 Like