Select date in edit mode 10 years by default
- Single Page
Posted 14 March 2012 - 19:44 PM
A small problem: I have a date field in database: birthDate.
In edit mode the select box show me 10 years before and 10 years after but my poor user is 40 years old, so his birth date in in 1972.
How can I change this default 10 years up/down on date field?
Posted 15 March 2012 - 14:12 PM
Actually, if you try to enter manually the date it will reset the select to 10 years up and down from your entered date.
Posted 20 March 2012 - 21:52 PM
Posted 23 July 2012 - 21:57 PM
$(document).ready(function()
{
var changeYear = $( ".datepicker-input" ).datepicker( "option", "changeYear" );
$( ".datepicker-input" ).datepicker( "option", "yearRange", "-20:+0" );
});
Posted 20 May 2013 - 02:18 AM
same problem with me, how make it amityweb? :)
Posted 12 February 2016 - 11:38 AM
hi loginet and deib97,
the simple way, just add the code from amityweb to the "jquery.datepicker.config.js" file
see the example below:
$(function(){
$('.datepicker-input').datepicker({
dateFormat: js_date_format,
showButtonPanel: true,
changeMonth: true,
changeYear: true
});
$('.datepicker-input-clear').button();
$('.datepicker-input-clear').click(function(){
$(this).parent().find('.datepicker-input').val("");
return false;
});
$(document).ready(function()
{
var changeYear = $( ".datepicker-input" ).datepicker( "option", "changeYear" );
$( ".datepicker-input" ).datepicker( "option", "yearRange", "-50:+0" );
});
});