How to to handle date validation on mobile and service portal via a client script which uses getDateFromFormat variable.


getDateFromFormat by design is not available on mobile and service portal.

Move the date validation to a script include and call the script include in the Client Script. You need to use GlideDateTime in the script include to handle the date validation with a specific user date format.

An example on to handle the date validation on server side.

var date = '10 Jul 2018 12:30:00'; 
var simpleDateFormat = 'dd MMMM yyyy HH:mm:ss'; // Simple Date Time format 
var gdt = new GlideDateTime(); 
gdt.setDisplayValue(date,simpleDateFormat); //Set time using current TZ 
gs.log(gdt.getDisplayValue()); // Output time in current TZ 

Applicable Versions

All versions

Additional Information

GlideDataTime and date validation

Article Information

Last Updated:2019-05-21 11:51:52