Would you like to know how to format the Date and time fields that you send via WF email? Or how to send only the Date or only the Time?
Open the Workflow, set up everything to send the email and use this JavaScript:
for Date and Time:
${doo.model.nameOfTheField.value ? new Date(doo.model.nameOfTheField.value + 'Z').toLocaleString('cs-CZ', { timeZone: 'Europe/Prague' }) : ''}
For Time only:
${doo.model.nameOfTheField.value ? new Date(doo.model.nameOfTheField.value + 'Z').toLocaleTimeString('cs-CZ', { timeZone: 'Europe/Prague' }) : ''}
For Date only:
${doo.model.nameOfTheField.value ? new Date(doo.model.nameOfTheField.value + 'Z').toLocaleDateString('cs-CZ', { timeZone: 'Europe/Prague' }) : ''}
Please modify the highlighted parts of the script to the name of the field with the date according to your application and modify to the time zone you prefer.
${doo.model.nameOfTheField.value ? new Date(doo.model.nameOfTheField.value + 'Z').toLocaleString('cs-CZ', { timeZone: 'Europe/Prague' }) : ''}
If you are not sure what the name of a field is, press the Fields button, select the field you want and the name will be written out, see picture:
If you are not sure what Time zone to choose, go to Edit application section, Advanced settings and check the Application time zone
That’s it! Simple and fast
Have a nice day.
With kind regards,
Soňa