checking and checkout

804 views
Skip to first unread message

Carlos Rocha

unread,
Jun 3, 2014, 5:34:56 PM6/3/14
to bootstrap-...@googlegroups.com

Hi, in original code the eyecode have example for check-in and checkout
http://www.eyecon.ro/bootstrap-datepicker/
Disabling dates in the past and dependent disabling.
this code not working whit this version of bootstrap-datepicker?

var nowTemp = new Date();
var now = new Date(nowTemp.getFullYear(), nowTemp.getMonth(), nowTemp.getDate(), 0, 0, 0, 0);

var checkin = $('#dpd1').datepicker({
onRender: function(date) {
return date.valueOf() < now.valueOf() ? 'disabled' : '';
}
}).on('changeDate', function(ev) {
if (ev.date.valueOf() > checkout.date.valueOf()) {
var newDate = new Date(ev.date)
newDate.setDate(newDate.getDate() + 1);
checkout.setValue(newDate);
}
checkin.hide();
$('#dpd2')[0].focus();
}).data('datepicker');
var checkout = $('#dpd2').datepicker({
onRender: function(date) {
return date.valueOf() <= checkin.date.valueOf() ? 'disabled' : '';
}
}).on('changeDate', function(ev) {
checkout.hide();
}).data('datepicker');

any help? i need use this version 1.3 but is more compatible with mobile version, the version eyecon not working in mobile version and bootstrap 3 :/

Cheers

Gerardo Dominguez

unread,
Jun 4, 2014, 5:09:42 PM6/4/14
to bootstrap-...@googlegroups.com
Hi, you can use the setStartDate function on changeDate event.
Sample:

$("#checkInDate").datepicker({
//any options
}).on('changeDate', function(ev) {
     $("#checkOutDate").datepicker("setStartDate",ev.date);//it set the minimun date when checkOutDate is showed

carlos

unread,
Jun 4, 2014, 9:36:36 PM6/4/14
to Gerardo Dominguez, bootstrap-...@googlegroups.com
thank i check the documentation :)


--
You received this message because you are subscribed to a topic in the Google Groups "bootstrap-datepicker" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/bootstrap-datepicker/VtVekquIVXI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to bootstrap-datepi...@googlegroups.com.
To post to this group, send email to bootstrap-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bootstrap-datepicker/7e398a32-ca4c-4999-a9df-8e64ba3b70f6%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages