setting a default time in a date and time field

Discussions about Forms Designer for SharePoint 2013 / 2016 and Office 365.
Locked
User avatar
Roo
Posts: 107
Joined: Tue Oct 24, 2017

12 May 2020

Is there a way I can default a time within a time/date field (say 00:01) within the forms designer?

I have a problem where people neglect to full the time in and as such the start and end date fields are reduced by one day.

Thanks

User avatar
mnikitina
Posts: 264
Joined: Wed Jun 05, 2019

12 May 2020

Hello Roo,

You can try out something like this. The below code checks hours and minutes and if it's set to midnight, it sets minutes to be equal 10.

Code: Select all

fd.field('Date').change(function(){
  var hours = fd.field('Date').value()[1];
  var minutes = fd.field('Date').value()[2];

  if(hours == '12 AM' && minutes == '00') {
  	console.log('wrong');
  	var date = fd.field('Date').value();
  	//set minutes to be equal 10
  	date.splice(2, 1, '10');
  	fd.field('Date').value(date);
  }
});

Locked
  • Information
  • Who is online

    Users browsing this forum: No registered users and 13 guests