});
// restrict datepicker for days after current date and 2 days after that date [min]
- today = new Date();
- minDays = 2;
- today.setDate(today.getDate() + minDays);
- d = today.getDate();
- m = today.getMonth() + 1;
- y = today.getFullYear();
- requiredDate = y + '-' + m + '-' + d;
-
- currentDate = document.getElementById('dateOff1');
-
- currentDate.addEventListener('change', function () {
- currentDate.value = new Date(currentDate.value).toISOString().split('T')[0];
- }, false);
+ $("#dateOff1").change(function () {
+ today = $("#dateOff1").val();
+ today = new Date(today);
+ minDays = 2;
+ today.setDate(today.getDate());
+ d = today.getDate();
+ if (d <= 9) {
+ d = '0' + d;
+ }
+ m = today.getMonth() + 1;
+ if (m <= 9) {
+ m = '0' + m;
+ }
+ y = today.getFullYear();
+ requiredDate = y + '-' + m + '-' + d;
+ alert(requiredDate);
+ });
+
$("#date1").datepicker({
minDate: 2,
onSelect: function (date) {
});
// restrict datepicker for days after current date and 2 days after that date [min]
- today = new Date();
- minDays = 2;
- today.setDate(today.getDate() + minDays);
- d = today.getDate();
- m = today.getMonth() + 1;
- y = today.getFullYear();
- requiredDate = y + '-' + m + '-' + d;
-
- currentDate = document.getElementById('dateOff1');
-
- currentDate.addEventListener('change', function () {
- currentDate.value = new Date(currentDate.value).toISOString().split('T')[0];
- }, false);
+ $("#dateOff1").change(function () {
+ today = $("#dateOff1").val();
+ today = new Date(today);
+ minDays = 2;
+ today.setDate(today.getDate());
+ d = today.getDate();
+ if (d <= 9) {
+ d = '0' + d;
+ }
+ m = today.getMonth() + 1;
+ if (m <= 9) {
+ m = '0' + m;
+ }
+ y = today.getFullYear();
+ requiredDate = y + '-' + m + '-' + d;
+ alert(requiredDate);
+ });
+
$("#date1").datepicker({
minDate: 2,
onSelect: function (date) {