date time format issue MM/DD/YYYY

keshav77
Tera Contributor

Hi All,

 

we have requirement for a particular field which is date and type and we want that should in MM/DD/YYYY in this format only not user can change it according to there preference for that particular filed how we can achieve that  

3 REPLIES 3

JenniferRah
Mega Sage

You could add a client script that runs after that field is changed and throws an error. You would also have to add an onSubmit client script to prevent them from saving it if it is in the wrong format.

But I am getting error - onChange script error: RangeError: Maximum call stack size exceeded function () { [native code] }

 

Kindly help me with this bellow is the code

keshav77_0-1736401913484.png

 

 

keshav77_1-1736401913492.png

 

 

JenniferRah
Mega Sage

Can you try something like this?

var edate = new Date(newValue);
var formattedDateTime = edate.format('yyyy-MM-dd hh:mm tt'); 
g_form.setValue('u_start_date', formattedDateTime);