Workflow - formát datumu

Hello,

can you please advise me how to set the format of the Date type item that I insert into the text of the notification email.

In the record I have entered e.g.: 10.1.2023
In the e-mail it shows: Tue Jan 10 2023 00:00:00 GMT+0100 (Central European Standard Time)

I need the email to display the format DD.MM.YYYY

Thank you.
Milan

Hello Milan,

use this JS to edit the format:

 ${doo.model.date.value ? new Date(doo.model.date.value + 'Z').toLocaleDateString('cs-CZ', { timeZone: 'Europe/Prague' }) : ''} 

date replace with the name of the date field and check the time zone to make sure it’s the one you want to use.

Example:
${doo.model.date.value ? new Date(doo.model.date.value + ‘Z’).toLocaleDateString(‘cs-CZ’, { timeZone: ‘Europe/Prague’ }) : ‘’}

Thank you

With kind regards,
Soňa

Hello Sonia,
thank you for your answer.
I tried, but I get this error: Invalid regular expression flags

I have it set in the workflow settings Send Email/Scope as follows:
${doo.model[“datum1dodavky”].value ? new Date(doo.model[“datum1dodavky”].value + ‘Z’).toLocaleDateString(‘cs-CZ’, { timeZone: ‘Europe/Prague’ }) : ‘’}

So am I wrong somewhere?

Thanks a lot. Milan

Hello Milan,

can you please correct the JS to:

${doo.model.datum1dodavky.value ? new Date(doo.model.datum1dodavky.value + ‘Z’).toLocaleDateString(‘cs-CZ’, { timeZone: ‘Europe/Prague’ }) : ‘’}

With kind regards,
Soňa

Hello Sonia, thank you, I tried again following your advice, the error is no longer displayed :slightly_smiling_face:, but in the incoming mail that Tabidoo sends within the set workflow, the script text is displayed instead of the requested date value … can I ask for advice?

Thank you very much. Milan