Datepicker only shows last 10 years
Permalink 1 user found helpful
I'd like to use the datepicker to have someone choose their date of birth but the date picker only shows +/- ten years from the current year. I realize you can just type in the year yourself in the input box, but I would like additional past years to show in the drop down as well - anyone know where I can find this in order to modify it?
That did it - thank you.
Hello
For me too, that worked - but not a long time. After 20 sec and without any manipulation the behaviour returned to the old way!!!
can anybody help???
thanks
Dan, switzerland (sorry 4 my bad english)
For me too, that worked - but not a long time. After 20 sec and without any manipulation the behaviour returned to the old way!!!
can anybody help???
thanks
Dan, switzerland (sorry 4 my bad english)
Again me. It was a simpel caching-problem. Solved!
thanks @ tom reitz!!!
thanks @ tom reitz!!!
copy the file to /helpers and name the class SiteDateTimeHelper instead of DateTimeHelper
Does it matter where in that line you put the code?
It does - here's line 141:
which should become
and here's line 198:
which similarly needs to become
Hope this helps!
$html .= '<script type="text/javascript">$(function() { $("#' . $id . '_dt").datepicker({ changeYear: true, showAnim: \'fadeIn\' }); });</script>';
which should become
$html .= '<script type="text/javascript">$(function() { $("#' . $id . '_dt").datepicker({ changeYear: true, showAnim: \'fadeIn\', yearRange: \'c-100:c+0\' }); });</script>';
and here's line 198:
$html .= '<script type="text/javascript">$(function() { $("#' . $id . '").datepicker({ changeYear: true, showAnim: \'fadeIn\' }); });</script>';
which similarly needs to become
$html .= '<script type="text/javascript">$(function() { $("#' . $id . '").datepicker({ changeYear: true, showAnim: \'fadeIn\', yearRange: \'c-100:c+0\' }); });</script>';
Hope this helps!
Strange. I still can't get this code to work.
flush your C5 cache and your browser cache? meinprotein apparently got it working.
Concrete5 could be using <site_root>/helpers/form/date_time.php instead of <site_root>/concrete5/helpers/form/date_time.php, if it exists.
Concrete5 could be using <site_root>/helpers/form/date_time.php instead of <site_root>/concrete5/helpers/form/date_time.php, if it exists.
This post referred to here worked but the line code number has changed in 5.6.3.1
In the 5.6.3.1 open <site_root>/concrete/helpers/form/date_time.php. If you only see few lines of code it means you opened the wrong one. Look for the correct one -- it is there.
The original line 152 reads:
Replaced with this one:
Line 209 that reads:
Replace with the same code as done earlier:
In the 5.6.3.1 open <site_root>/concrete/helpers/form/date_time.php. If you only see few lines of code it means you opened the wrong one. Look for the correct one -- it is there.
The original line 152 reads:
if ($calendarAutoStart) { $html .= '<script type="text/javascript">$(function() { $("#' . $id . '_dt").datepicker({ dateFormat: \'' . DATE_APP_DATE_PICKER . '\', changeYear: true, showAnim: \'fadeIn\' }); });</script>';
Replaced with this one:
if ($calendarAutoStart) { $html .= '<script type="text/javascript">$(function() { $("#' . $id . '_dt").datepicker({ dateFormat: \'' . DATE_APP_DATE_PICKER . '\', changeYear: true, showAnim: \'fadeIn\', yearRange: \'c-100:c+0\' }); });</script>';
Line 209 that reads:
if ($calendarAutoStart) { $html .= '<script type="text/javascript">$(function() { $("#' . $id . '").datepicker({ dateFormat: \'' . DATE_APP_DATE_PICKER . '\', changeYear: true, showAnim: \'fadeIn\' }); });</script>';
Replace with the same code as done earlier:
if ($calendarAutoStart) { $html .= '<script type="text/javascript">$(function() { $("#' . $id . '_dt").datepicker({ dateFormat: \'' . DATE_APP_DATE_PICKER . '\', changeYear: true, showAnim: \'fadeIn\', yearRange: \'c-100:c+0\' }); });</script>';
Although this is an expired topic, i would like to make an addition to it. I was also experiencing problems with the datetime-picker and its limited year range.
For me the suggested solution didn't work, because it changes the year range according to the year you select - 100 years. Meaning that when I select the year 1913 the range will be from 1813 - 1913. Years higher than 1913 dissapear, and there seems to be no way back.
What I used is:
yearRange: "-100:+0"
In case anyone else is experiencing the same problem i'd like to share it.
For me the suggested solution didn't work, because it changes the year range according to the year you select - 100 years. Meaning that when I select the year 1913 the range will be from 1813 - 1913. Years higher than 1913 dissapear, and there seems to be no way back.
What I used is:
yearRange: "-100:+0"
In case anyone else is experiencing the same problem i'd like to share it.
Thanks for sharing, I have the same problem this should help!
Where are the date_time.php files in 5.6.2.1?
I only have 22 lines in that file.
I only have 22 lines in that file.
http://www.concrete5.org/community/forums/customizing_c5/date-picker-year-range/#506233
to the argument list of the datepicker() calls in <site_root>/concrete/helpers/form/date_time.php (lines 141 and 198).
of course you'll probably loose this change next time you update C5.