Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 1st, 2012  |  syntax: None  |  size: 3.03 KB  |  hits: 11  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. how to validate/check the inserted date to current date
  2. id     nic     date
  3. 1      765     2012-04-20
  4. 2      654     2012-03-19
  5. 3      777     2011-01-08
  6.        
  7. var A_TCALCONF = {
  8.     'cssprefix'  : 'tcal',
  9.     'months'     : ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
  10.     'weekdays'   : ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
  11.     'longwdays'  : ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  12.     'yearscroll' : true, // show year scroller
  13.     'weekstart'  : 0, // first day of week: 0-Su or 1-Mo
  14.     'prevyear'   : 'Previous Year',
  15.     'nextyear'   : 'Next Year',
  16.     'prevmonth'  : 'Previous Month',
  17.     'nextmonth'  : 'Next Month',
  18.     'format'     : 'Y-m-d' //'d/m/Y' // 'd-m-Y', Y-m-d', 'l, F jS Y'
  19. };
  20.  
  21. var A_TCALTOKENS = [
  22.      // A full numeric representation of a year, 4 digits
  23.     {'t': 'Y', 'r': '19\d{2}|20\d{2}', 'p': function (d_date, n_value) { d_date.setFullYear(Number(n_value)); return d_date; }, 'g': function (d_date) { var n_year = d_date.getFullYear(); return n_year; }},
  24.      // Numeric representation of a month, with leading zeros
  25.     {'t': 'm', 'r': '0?[1-9]|1[0-2]', 'p': function (d_date, n_value) { d_date.setMonth(Number(n_value) - 1); return d_date; }, 'g': function (d_date) { var n_month = d_date.getMonth() + 1; return (n_month < 10 ? '0' : '') + n_month }},
  26.      // A full textual representation of a month, such as January or March
  27.     {'t': 'F', 'r': A_TCALCONF.months.join('|'), 'p': function (d_date, s_value) { for (var m = 0; m < 12; m++) if (A_TCALCONF.months[m] == s_value) { d_date.setMonth(m); return d_date; }}, 'g': function (d_date) { return A_TCALCONF.months[d_date.getMonth()]; }},
  28.      // Day of the month, 2 digits with leading zeros
  29.     {'t': 'd', 'r': '0?[1-9]|[12][0-9]|3[01]', 'p': function (d_date, n_value) { d_date.setDate(Number(n_value)); if (d_date.getDate() != n_value) d_date.setDate(0); return d_date }, 'g': function (d_date) { var n_date = d_date.getDate(); return (n_date < 10 ? '0' : '') + n_date; }},
  30.     // Day of the month without leading zeros
  31.     {'t': 'j', 'r': '0?[1-9]|[12][0-9]|3[01]', 'p': function (d_date, n_value) { d_date.setDate(Number(n_value)); if (d_date.getDate() != n_value) d_date.setDate(0); return d_date }, 'g': function (d_date) { var n_date = d_date.getDate(); return n_date; }},
  32.      // A full textual representation of the day of the week
  33.     {'t': 'l', 'r': A_TCALCONF.longwdays.join('|'), 'p': function (d_date, s_value) { return d_date }, 'g': function (d_date) { return A_TCALCONF.longwdays[d_date.getDay()]; }},
  34.     // English ordinal suffix for the day of the month, 2 characters
  35.     {'t': 'S', 'r': 'st|nd|rd|th', 'p': function (d_date, s_value) { return d_date }, 'g': function (d_date) { n_date = d_date.getDate(); if (n_date % 10 == 1 && n_date != 11) return 'st'; if (n_date % 10 == 2 && n_date != 12) return 'nd'; if (n_date % 10 == 3 && n_date != 13) return 'rd'; return 'th'; }}
  36.  
  37. ];
  38.        
  39. var dates = $("#from").datepicker({
  40. defaultDate: "+1w",  
  41. minDate: new Date()
  42. }
  43. });