Get current date on a new Bonita 7 form

1
0
-1

Hi,

Maybe this is a dumb question but I've had issues trying to get the current date in a form.

First I create a variable and I call it "currentDate" as this JS expression:

return new Date();

Then I put a widget (text, input, title, etc) with this value.

Today is {{ currentDate | Date }}

Then I try the form.

When the form runs, it enters on an infinite loop, It always refresh the variable.

I've tried solve this using a condition (if variable is null -or undefined- get date else get the current value...) but this does not work.

Well I hope you can help me, thanks in advance.

2 answers

1
0
-1

Convert this:
Today is {{currentDate | Date}}
For this:
Today is {{currentDate | uiDate}}
You can format the date too:
Today is {{currentDate | uiDate:'dd/MM/yyyy'}}

1
0
-1

Hi dbravo!
Try this: put "Date" with lowercase "date" and complete the expression on "Date" like this
Today is {{ currentDate | date:'dd/MM/yyyy HH:mm'}}
Please let me know if it works for you
Thanks

Notifications