Validate Control Date/Time to start from 5.AM to 11. PM

  • 26 October 2017
  • 1 reply
  • 2 views

Badge +6

Hello Team, I was wondering if is possible set up a control Date/Time to default value 5.AM avoiding from 12 am to 4 am? what i need is keed a range from 5.am to 11 pm. Thanks in advance. Regards

 

210089_pastedImage_1.png


1 reply

Badge +9

Try this code.

NWF$(document).ready(function()
{
var fullDate = new Date()
var twoDigitMonth = ("0" + (fullDate.getMonth() + 1)).slice(-2)
var hours = fullDate.getHours();
var minutes = fullDate.getMinutes();
var currentDate = fullDate.getDate() + "/" + twoDigitMonth + "/" + fullDate.getFullYear();
if (hours < 10) { hours = "0" + hours; }
minutes = minutes - 2.5;
minutes = 5 * Math.round( minutes / 5 );
NWF$('#' + fldDate).val(currentDate);

NWF$('#' + fldDate+ " + IMG + SELECT").val('10 AM');
NWF$('#' + fldDate+ " + IMG + SELECT + SELECT").val('45');

});

Reply