Checking if date only is entered for a Date and Time variable

  • Published by Viedoc System 2019-05-06
  • Print

The Date and Time variable returns time 00:00 if only the date is being filled in. You might want to check for this, in order to make sure that the site user does not miss to enter the time as well.

To do that, you can use the following code as an edit check for the Date and Time variable. Replace the ItemID below with the ID of your Date and Time variable:

var datetocheck = new Date(ItemID);

if (datetocheck != null && datetocheck.getHours() == 0 && datetocheck.getMinutes() == 0)

return false;

return true;