Can anyone explain the logic of this re date time manipulation

I am currently in UK which is UTC timezone with summer time adjustment to UTC + 1

I have a very simple api action

stage 1
sets a value called base to NOW

in this case it correctly returns

"base":"2026-08-31 09:33:00"

I now add 20 minutes
plus20 = NOW.dateAdd('minutes', 20)
this outputs:

plus20":"2026-08-31T08:53:00.000Z

This adds 20 minutes but removes 1 hr (returns UTC?)

I have to then use the toLocalTime() formatter to restore the correct time

fixed = NOW.dateAdd('minutes', 20).toLocalTime()

"fixed":"2026-08-31 09:53:00.000"

What is the logic behind dateAdd reverting time back to UTC?

Internally the date object in Javascript is stored as milliseconds since epoch (January 01, 1970 00:00:00 UTC). We don't store the actual Date object or the number of milliseconds in the data scope but store it as a string. We decided for the UTC time format as it is the most universal and Javascript directly supports it without needing a custom formatter.

All date formatters support different input data (local/UTC time string, UNIX timestamp or a string like 'now'), this is being parsed and created a Javascript Date object which then is used to do the manipulations. The output of the formatter then uses the UTC time string.

We could perhaps add an extra argument to each formatter to directly format the output or perhaps have some global option for the default date formatting.

Not a big issue, the workaround is easy enough.
I just wondered why the timezone was discarded when using dateAdd.
I suppose an extra option "Preserve Timezone" could be useful to some.

I found this as i was trying to save a NOW.dateAdd() value to a datetime database field (maria db) and an error was thrown.

The actual cause of the error was the resultant format change (addition of T and Z parameters), i noticed as a side issue that the zone was also changed to UTC.

Using toLocalTime() resolves both issues so happy with that.

The format is using the international ISO 8601 standard, there the T and Z are defined. The T is separates the date and time part. The Z indicates it is UTC time. If you remove the Z it is read as local time. Most parsers allow the T be replaces with a space but that is not in the standard.

ISO 8601 - Wikipedia

JavaScript always uses UTC as timezone when formatting in ISO format.

Date.prototype.toISOString() - JavaScript | MDN