Join the Team Forms community

E
R
A
T
C

Date field output showing different format when selected

Last updated 2 months ago
K
Kiki

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

A
Anthony Phan
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
A
Anthony Phan

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()