directus-extension-computed-interface icon indicating copy to clipboard operation
directus-extension-computed-interface copied to clipboard

Tying to calculate the sum of days from two date time inputs?

Open DangerDrome opened this issue 11 months ago • 1 comments

Tying to calculate the sum of days from two date time inputs, such as:

{{ DAY(SUBTRACT(end, start)) }} or {{ SUBTRACT(DAY(end), DAY(start)) }}

But just getting 0, debug doesn't seem to display anything:

image

Probably user error...

DangerDrome avatar Mar 16 '24 00:03 DangerDrome

After some breif debugging, the following don't appear to be working?

YEAR(a) | get year of a date object, similar to getFullYear MONTH(a) | get month of a date object, similar to getMonth GET_DATE(a) | get date of a date object, similar to getDate DAY(a) | get day of a date object, similar to getDay

However this seems to work:

{{ SUBTRACT(GET_DATE(DATE(end)), GET_DATE(DATE(start))) }}

DangerDrome avatar Mar 16 '24 00:03 DangerDrome