newbie here - ive created a webform where a client completes field to book a property.
In the form i have a check-in and check-out date and I wanted to include in the email trigger node the number of nights (check-in - check-out)
so far ive managed to create the workflow which takes the form data , created a contact in our cRM and then sends an email with the booking request. But i want to include the number of nights in the email but not sure how to do this?
thanks
Describe the problem/error/question
What is the error message (if any)?
Please share your workflow
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Hi @solp Welcome!
In code node i think you can use the javascript function diffTo() , like this: {{ $json.checkOutDate.toDateTime().diffTo($json.checkInDate.toDateTime(), 'days') }}
or with diff only: {{ DateTime.fromISO($json.checkOutDate).diff(DateTime.fromISO($json.checkInDate), 'days').toObject().days }}
and then you can easily place this expression directly in your HTML mail, or more simpler way that to use a set field node and then calculate it before sending it on mail and then just directly pass that, a code node can easily handle that.