In date/time variable,should be selected in PST time zone and should not allow past dates selection

Bhanu_thej
Tera Contributor

Hi @Ankur Bawiskar @Maik Skoddow @Mohith Devatte @SwarnadeepNandy @SANDEEP28 

 

My requirement is,In date/time variable,date should be selected in PST time zone and should not allow users to select past dates.

 

i have already an existing client script which makes users not to select PST time zone.Here is the screenshot below 

 

Bhanu_thej_0-1695265824202.png

Please help me on my requirement.

13 REPLIES 13

@Bhanu_thej  

it will show date/time to the user based on his/her profile timezone

 

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar 

 

Currently my time zone is PST, still it was not allowing to select PST time zone, it is allowing IST time Zone.Currently i am using below script.

function onChange(control, oldValue, newValue, isLoading, isTemplate) {    
if (isLoading || newValue === '') {
return;
}
 
var currentDate = new Date().getTime();
var refreshDate = new Date(g_form.getValue('start_date')).getTime();
if (refreshDate < currentDate) {
var message = 'Date shuold be in Future Date';
g_form.showErrorBox('start_date', message);
g_form.clearValue('start_date');
// g_form.showFieldMsg('revised_refresh_date', "Date Should not a Past Date", 'error');
}
 
}

Bhanu_thej_0-1697768800125.png

 

@Bhanu_thej  

you are just doing validation.

Can you share screenshots of the time what it shows for that user?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi @Ankur Bawiskar 

 

i could not select the current date in the form, but i can select the future date as shown in screen shot. the requirement is to select the current date and time in the  form according to the instance timezome.could you please help me on this.

Bhanu_thej_0-1698394120520.png