Date transformation functions not working

Describe the problem/error/question

I’m trying to take a date timestamp as an output from a previous node, and check if it was within the last day. i’ve determined i’m able to turn the timestamp string into a date object using the following expression:

{{ DateTime.fromISO($json[“My Timestamp”])}}

Using n8n’s built-in expression .isInLast() , the boolean result always returns false. I’ve used the following syntax:
{{ DateTime.fromISO($json[“My Timestamp”]).isInLast()}}
{{ DateTime.fromISO($json[“My Timestamp”]).isInLast(1 day)}}
{{ DateTime.fromISO($json[“My Timestamp”]).isInLast(1, day)}}

The following screenshots display tests.

@ugly1 , the unit is expected to be a string, that is

{{ DateTime.fromISO($json[“My Timestamp”]).isInLast(1, 'day') }}
2 Likes

Ah of course! Thank you for your response, this resolved the issue.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.