Currently, users can choose any date even greater than today to register a patient. They are supposed to be able to register the patient into the system who had their treatment few days back but not for upcoming treatment. In short, I wish to disable the users from choosing a date greater than today. So, here's what I have :
$(document).ready(function(){
$('.datefield').datetimepicker({ 'dateFormat': 'dd-mm-yy' });
$("#register_date").val( $dss.getDate("dd-mm-yyyy jj:nn") )
if ($("#cancel_date").val() == "" ){ //00-00-0000 00:00
$("#cancel_date").val( $dss.getDate("dd-mm-yyyy jj:nn") )
}
user_name = "<?php echo $_SESSION['USER_NAME']; ?>"
user_id = "<?php echo $_SESSION['USER_ID']; ?>"
ipdMC();
$("#cancel_id").val(user_id);
///--> getLabStatus();
physio_list_start();
$$live();
});
and this as my reference :
*$(document).ready(function (){
var todaysDate = new Date(); // Gets today's date
// Max date attribute is in "YYYY-MM-DD". Need to format today's date accordingly
var year = todaysDate.getFullYear(); // YYYY
var month = ("0" + (todaysDate.getMonth() + 1)).slice(-2); // MM
var day = ("0" + todaysDate.getDate()).slice(-2); // DD
var maxDate = (day +"-"+ month +"-"+ year); // Results in "YYYY-MM-DD" for today's date
// Now to set the max date value for the calendar to be today's date
$('.inspectionDate input').attr('max',maxDate);
});*
you can use mindate to make the datetimepicker disabled to the date greater than today
$(document).ready(function(){
$('.datefield').datetimepicker({
'dateFormat': 'dd-mm-yy',
'maxDate': 0
});
$("#register_date").val( $dss.getDate("dd-mm-yyyy jj:nn") )
if ($("#cancel_date").val() == "" ){ //00-00-0000 00:00
$("#cancel_date").val( $dss.getDate("dd-mm-yyyy jj:nn") )
}
user_name = "<?php echo $_SESSION['USER_NAME']; ?>"
user_id = "<?php echo $_SESSION['USER_ID']; ?>"
ipdMC();
$("#cancel_id").val(user_id);
///--> getLabStatus();
physio_list_start();
$$live();
});
but make if you use javascript your timezone will be using client side timezone so be careful
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.