2

I use Jtsage date picker in my mobile application(jquery mobile and phonegap). I want to show only today and before today date(hide future dates ) so i refer this documentaion. In that documentation they mention afterToday,beforeToday,notToday,minDays,maxDays. I use beforeToday for my datebox but it seems not working.
My date picker calling is like:

 <input name="mydate" id="mydate" type="date" data-role="datebox" data-options='{"mode": "datebox", "useNewStyle":true,"afterToday":false,"beforeToday":true,"maxDays": 1}'/>

refer this Fiddle Demo

Vini
  • 967
  • 1
  • 15
  • 33

1 Answers1

1

One way is to add an event to catch the 'set'. If date being set is in the future, popup a message and stopImmediatePropagation:

$('#mydate').on('datebox', function (event, payload) {
    if (payload.method === 'set') {
        var startdate = new Date();
        if (payload.date > startdate) {
            window.alert('You cannot select future dates!');
            e.stopImmediatePropagation();
        }
   }
});

Updated FIDDLE

ezanker
  • 24,628
  • 1
  • 20
  • 35
  • any idea http://stackoverflow.com/questions/25280308/how-to-disable-the-already-selected-date-for-next-date-box-in-j-t-sage-date-pick – Vini Aug 13 '14 at 07:21