rezo-labs / directus-extension-computed-interface

Perform computed value based on other fields
GNU General Public License v3.0
201 stars 27 forks source link

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

Open DangerDrome opened 6 months ago

DangerDrome commented 6 months ago

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 commented 6 months ago

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))) }}