Join the Team Forms community

Date field output showing different format when selected

Updated 4 months ago

When using date field in a form, default output string is in UTC timezone, example: 2024-07-11T04:52:11.000Z. However when a date is selected from calendar output string changed to different ISO 8601 format, example: 2024-07-11T00:00:00+10:00.

When this output is processed in Power Automate, it become inconsistent (could be a day different).

Can we have a consistent date string when the date is defaulted or selected from calendar?

Thanks,

Kiki

Marked as solution

Hi Kiki,

When setting the default date setting using moment() this will unfortunately return the current date in UTC.

However, you can work around this by using the "Custom Default Value" setting available in the data tab. The following JavaScript should set the value in the desired format:

value = moment().format()

Alternatively, if you want no time component you might be able to do something like this (note this is untested)

value = moment().startOf('day').format()

View full solution
A
1 comment

Hi Kiki,

When setting the default date setting using moment() this will unfortunately return the current date in UTC.

However, you can work around this by using the "Custom Default Value" setting available in the data tab. The following JavaScript should set the value in the desired format:

value = moment().format()

Alternatively, if you want no time component you might be able to do something like this (note this is untested)

value = moment().startOf('day').format()