Comparing version 1.2.1 to 1.2.2
# Changelog | ||
All notable changes to this project will be documented in this file. | ||
[1.2.2] - 2018-08-24 | ||
* new callback: onError | ||
Calling when `disabledDatesInRange` is set to `false` and user is select range includes disabled dates. | ||
* minor bug fixes | ||
[1.2.0] - 2018-08-23 | ||
@@ -5,0 +10,0 @@ * new option: disabledDatesInRange |
@@ -52,2 +52,3 @@ /** | ||
onClose: null, | ||
onError: null, | ||
hoveringTooltip: true, | ||
@@ -326,12 +327,12 @@ hideOnBodyClick: true, | ||
}), | ||
closestPrev = disabledArray.filter(function(d) { | ||
return d.isBefore(opts.startDate); | ||
closestPrev = moment(disabledArray.filter(function(d) { | ||
return moment(d).isBefore(opts.startDate); | ||
}).sort(function(a,b){ | ||
return b.isAfter(a); | ||
})[0], | ||
closestNext = disabledArray.filter(function(d) { | ||
return d.isAfter(opts.startDate); | ||
return moment(b).isAfter(moment(a)); | ||
})[0]), | ||
closestNext = moment(disabledArray.filter(function(d) { | ||
return moment(d).isAfter(opts.startDate); | ||
}).sort(function(a,b){ | ||
return a.isAfter(b); | ||
})[0]; | ||
return moment(a).isAfter(moment(b)); | ||
})[0]); | ||
@@ -506,10 +507,15 @@ [].forEach.call(days, function(dayCell) { | ||
if (opts.footer) { | ||
var footerMessage = self.el.querySelector('.lightpick__footer-message'); | ||
if (footerMessage) { | ||
footerMessage.innerHTML = opts.locale.not_allowed_range; | ||
if (typeof self._opts.onError === 'function') { | ||
self._opts.onError.call(self, 'Invalid range'); | ||
} | ||
else { | ||
var footerMessage = self.el.querySelector('.lightpick__footer-message'); | ||
setTimeout(function(){ | ||
footerMessage.innerHTML = ''; | ||
}, 3000); | ||
if (footerMessage) { | ||
footerMessage.innerHTML = opts.locale.not_allowed_range; | ||
setTimeout(function(){ | ||
footerMessage.innerHTML = ''; | ||
}, 3000); | ||
} | ||
} | ||
@@ -516,0 +522,0 @@ } |
{ | ||
"name": "lightpick", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"description": "Javascript date range picker - lightweight, no jQuery", | ||
@@ -5,0 +5,0 @@ "main": "lightpick.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103483
1744