Date2Num Function Replacement in JavaScript for HTML5 form | Community
Skip to main content
pranaym48551345
New Participant
September 7, 2021
Solved

Date2Num Function Replacement in JavaScript for HTML5 form

  • September 7, 2021
  • 1 reply
  • 789 views

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

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Pulkit_Jain_

@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.html?lang=en#formcalc 

1 reply

Pulkit_Jain_
Pulkit_Jain_Accepted solution
Employee
September 7, 2021

@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.html?lang=en#formcalc