jQueryMobile - DateBox

Home

jQuery Mobile Framework :: DateBox

A Date and Time Picker plugin for jQueryMobile

Dynamic Ending Date

You can dynamically set a start date for you calendar (or android mode) too.

Source Code
HTML
<label for="dynend">Only till Jun 30</label>
<input name="dynend" type="text" data-role="datebox" data-options='{"mode": "calbox", "maxDays" : 30}' id="dynend" />
jQuery
function getdays() { 
  var rightnow = new Date()
    today = new Date(rightnow.getFullYear(), rightnow.getMonth(), rightnow.getDate(), 0,0,0,0)
    maxdate = new Date(2012, 5, 30, 0,0,0,0)

  daysuntil = ( maxdate - today ) / ( 1000 * 60 * 60 * 24 )

  return parseInt(daysuntil,10)
}

$('#dynend').live('dateboxcreate', function() {
  $('#dynend').datebox({'maxDays': getdays()});
});