Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

Date2Num Function Replacement in JavaScript for HTML5 form

pranaym48551345
Level 2
Level 2

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
PulkitJain
Correct answer by
Employee
Employee

@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
PulkitJain
Correct answer by
Employee
Employee

@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