how to disable previous dates in calender in php? - javascript

$('#eventDate-container .input-group.date').datepicker({
weekStart: 1, // calendar starts on Monday
autoclose: true,
todayHighlight: true,
startDate: "4/10/2017", // disables all dates prior to this date
datesDisabled: ['01/01/1970', '12/31/2099'] // placeholder sample for possible future use
});

first i think that what you need is a "jquery" code not in "PHP"
, you can disable previous dates from jquery datepicker by using minDate: option
like :
var tardate = new Date("4/10/2017");
$("#eventDate-container").datepicker({
weekStart: 1, // calendar starts on Monday
autoclose: true,
todayHighlight: true,
minDate: tardate,
});
here's jsfiddle link

Related

Why i cannot set the weekstart to Monday?

I have a bootstrap datepicker (* Datepicker for Bootstrap v1.9.0 (https://github.com/uxsolutions/bootstrap-datepicker))
I need Monday to be displayed first instead of Sunday.
I've tried this: included bootstrap-datepicker.en-GB.min.js file (in which weekstart=1); then wrote the following in my script:
<script>
$('.datepicker').datepicker({
format: 'dd/mm/yyyy',
todayHighlight: 'TRUE',
autoclose: true,
language: "en-GB",
locale: "en-GB",
weekStart: 1,
})
</script>
Help please
Try , instead of weekStart: 1 use firstDay: 1

foundation datepicker datesdisabled

I am trying to disable holidays in my calendar but can't seem to pass the right format to the datesdisabled option.
I have
$('#booking').fdatepicker({
var now = new Date();
$('#booking').fdatepicker({
format: 'dd MM yyyy',
startDate: now,
daysOfWeekDisabled: [0, 4, 5],
datesDisabled:['2018-02-13']
});
})
What am I missing?
Use it this way, as it doesn't support the way you are using it. Also, it doesn't support time, just date.
$(function(){
$('#dpt').fdatepicker({
initialDate: new Date(),
format: 'yyyy-mm-dd hh:ii',
disableDblClickSelection: true,
language: 'es',
pickTime: true,
datesDisabled:['2018-01-15']
});
});

3 datepick in 3 forms in 1 page

I have 1 page that have 3 form in it, then my problem is my datepicker is working 1 only, the other make null result, how can I use this 3 date picker in 3 different form ?
here's my JS
$(document).ready(function(){
var date_input=$('input[name="date"]'); //our date input has the name "date"
var container=$('.bootstrap-iso form').length>0 ? $('.bootstrap-iso form').parent() : "body";
date_input.datepicker({
format: 'dd/mm/yyyy',
container: container,
todayHighlight: true,
autoclose: true,
})
})
just in case, I possible how can I make 3 datepick with different name ? (like date, date1 & date3)
in this 1 JS
instead of using var date_input=$('input[name="date"]');
add unique id to each datepicker and use above line like this
var date_input=$('#datepiker1, #datepickwer2, #datepicker3');
should work fine
try these
Try 1: if works that means your datepicker or datepiker1 has not yet been loaded
setTimeout(function(){
var date_input=$('#datepiker1, #datepickwer2, #datepicker3');
date_input.datepicker({
format: 'dd/mm/yyyy',
container: container,
todayHighlight: true,
autoclose: true,
});
}, 500);
try 2:
$("#datepiker1").datepicker({
format: 'dd/mm/yyyy',
container: container,
todayHighlight: true,
autoclose: true,
})
$("#datepiker2").datepicker({
format: 'dd/mm/yyyy',
container: container,
todayHighlight: true,
autoclose: true,
})
$("#datepiker3").datepicker({
format: 'dd/mm/yyyy',
container: container,
todayHighlight: true,
autoclose: true,
})

Is it possible to customize the years range in bootstrap date picker

I have a attribute name is assessment year,in that attribute if i choose the year(ex 2012),the bootstrap date picker display the 2012 calendar only
my js file
$('.datepicker').datepicker({
format: "dd/mm/yyyy",
todayHighlight: true,
todayBtn: 'linked',
autoclose: true
});
I searched the lot of things,still i am not get a correct answer...help me friends
simple just add startDate and endDate assuming that you selected year "2016" http://jsfiddle.net/LcqM7/542/
$('.datepicker').datepicker({
autoclose: true,
startDate: '01/01/2016',
endDate: '12/31/2016'
});

How to disable date before today in datetimepicker bootstrap?

Demo and full code is like this : http://fiddle.jshell.net/oscar11/dgb09c5c/5/
My Javascript code is like this :
$('#time-start').datetimepicker({
format: 'yyyy-mm-dd hh:ii:ss',
autoclose: true,
pickerPosition: "bottom-left",
maxView: 3,
minuteStep: 1,
minDate: new Date()
})
How to disable date before today?
I add minDate: new Date(), but it's not working
Any solution to solve my problem?
From Bootstrap datetime picker documentation
$.fn.datetimepicker.defaults = {
maskInput: true, // disables the text input mask
pickDate: true, // disables the date picker
pickTime: true, // disables de time picker
pick12HourFormat: false, // enables the 12-hour format time picker
pickSeconds: true, // disables seconds in the time picker
startDate: -Infinity, // set a minimum date
endDate: Infinity // set a maximum date
};
I modified your Fiddle. Is it what you are looking for? http://fiddle.jshell.net/dgb09c5c/6/

Categories