code_junkie

jQuery datepicker years shown

Nov 12th, 2011
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. $("#restricting").datepicker({
  2. yearRange: "-20:+0", // this is the option you're looking for
  3. showOn: "both",
  4. buttonImage: "templates/images/calendar.gif",
  5. buttonImageOnly: true
  6. });
  7.  
  8. "$(".selector").datepicker({ beforeShowDay: nationalDays})
  9. natDays = [[1, 26, 'au'], [2, 6, 'nz'], [3, 17, 'ie'], [4, 27, 'za'],
  10. [5, 25, 'ar'], [6, 6, 'se'], [7, 4, 'us'], [8, 17, 'id'], [9, 7,
  11. 'br'], [10, 1, 'cn'], [11, 22, 'lb'], [12, 12, 'ke']];
  12. function nationalDays(date) {
  13. for (i = 0; i < natDays.length; i++) {
  14. if (date.getMonth() == natDays[i][0] - 1 && date.getDate() ==
  15. natDays[i][1]) {
  16. return [false, natDays[i][2] + '_day'];
  17. }
  18. }
  19. return [true, ''];
  20. }
  21.  
  22. $( ".datefield" ).datepicker({
  23. changeMonth: true,
  24. changeYear: true,
  25. yearRange:-90:+0
  26. });
  27.  
  28. .au_day {
  29. text-indent: -9999px;
  30. background: #eee url(au.gif) no-repeat center;
  31. }
Add Comment
Please, Sign In to add comment