Expand my Community achievements bar.

SOLVED

Date2Num Function Replacement in JavaScript for HTML5 form

Avatar

Level 4

Hi All,

I am trying to work on the logic to view difference between two dates in HTML5 form, however i believe the Date2Num function is not working.

 

Can someone please let me know if we can use the Date2Num function is JavaScript or if there is any alternate solution to this.

Also can you please suggest if we can use the Date2Num function for HTML5 form also.

 

Thanks

Pranay

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

@pranaym48551345 

Date2Num function is not available in Javascript as the JavaScript Date object does not use the epoch as a reference point while Formcalc does. It returns the number of days since the epoch, given a date string, Reference document.

Although, i don't see this function part of the list in FormCalc method supported by HTML5 https://experienceleague.adobe.com/docs/experience-manager-65/forms/html5-forms/scripting-support.ht... 

View solution in original post

1 Reply

Avatar

Correct answer by
Employee Advisor

@pranaym48551345 

Date2Num function is not available in Javascript as the JavaScript Date object does not use the epoch as a reference point while Formcalc does. It returns the number of days since the epoch, given a date string, Reference document.

Although, i don't see this function part of the list in FormCalc method supported by HTML5 https://experienceleague.adobe.com/docs/experience-manager-65/forms/html5-forms/scripting-support.ht...