I'm using Bootstrap-Datepicker, and it's working really well.
One of the fields I'm using it for is a date of birth, and I know what the approximate age of the applicants is going to be, so it makes sense for me to default the picker to showing January 2000.
However, the only way I've found of doing this is to select a date, which actually updates the field with a value, which I don't want.
$(document).ready(function () {
var datePickers = $('input[data-provide="datepicker"]');
datePickers.each(function () {
var datePicker = $(this);
datePicker.datepicker('setDate', new Date(2000, 1, 1));
});
});
Is there a method in the object to select the view date or similar?
This is the default view I'm looking for:
(Apologies if this is a duplicate - I looked but only found questions about how to actually pick dates.)
Go to line 1399 and find format: 'mm/dd/yyyy' . Now you can change the date format here.
Syntax: $(". selector"). datepicker( {defaultDate:"+6"} );
datepicker(). on('changeDate', function (ev) { $('#example1'). Close(); });
Here it is:
$('.datepicker').datepicker({
defaultViewDate: {year:2000, month:0, day:1},
});
And the js Fiddle:
https://jsfiddle.net/mb34zwg3/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With