Using $NOW Dynamic Variable in API

I am wondering what I am missing between the docs and my understanding. I am using the $NOW dynamic variable in an API call from my front end to Directus in comparison to a DateTime field, but it appears to not be comparing timezone to timezone. When I am setting the variable in the directus app it seems to “set to now” just fine compared to my current timezone (UTC+1) but when using the $NOW variable on the front end it appears to be comparing to (UTC+0)? It isnt clear if the $NOW dynamic variable is set to be now with timezone information or plain UTC now? Does anyone have any clarity on the matter?

1 Answer

1

Seems like $NOW is simply parsed as new Date() which would return a UTC timestamp.

In case you are using postgres you might also be interested which field is actually created using Timestamp vs DateTime: https://community.directus.com/t/how-to-create-a-field-with-postgres-schema-definition/546/2?u=nik