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
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