Commit b5ee28eb authored by Tomas Pettersson's avatar Tomas Pettersson 🏸

limits period date to be within max and min

parent 14d0d1e2
...@@ -589,6 +589,9 @@ var STWkit; ...@@ -589,6 +589,9 @@ var STWkit;
PeriodCard.prototype.changeFn = function (changeCard) { PeriodCard.prototype.changeFn = function (changeCard) {
var self = this; var self = this;
if ((typeof changeCard.obsDateInput !== 'undefined') && (typeof changeCard.obsTimeInput !== 'undefined')) { if ((typeof changeCard.obsDateInput !== 'undefined') && (typeof changeCard.obsTimeInput !== 'undefined')) {
var date = moment.utc(changeCard.obsDateInput.value + ' ' + changeCard.obsTimeInput.value, self.datetimeFormat);
if (date.isBefore(self.minDate) || date.isAfter(self.maxDate))
return;
self.startDateInput.value = changeCard.obsDateInput.value; self.startDateInput.value = changeCard.obsDateInput.value;
self.startTimeInput.value = changeCard.obsTimeInput.value; self.startTimeInput.value = changeCard.obsTimeInput.value;
self.updateFromStartDate(); self.updateFromStartDate();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -651,6 +651,8 @@ module STWkit { ...@@ -651,6 +651,8 @@ module STWkit {
public changeFn(changeCard) { public changeFn(changeCard) {
var self = this; var self = this;
if ((typeof changeCard.obsDateInput !== 'undefined') && (typeof changeCard.obsTimeInput !== 'undefined')) { if ((typeof changeCard.obsDateInput !== 'undefined') && (typeof changeCard.obsTimeInput !== 'undefined')) {
var date = moment.utc(changeCard.obsDateInput.value + ' ' + changeCard.obsTimeInput.value, self.datetimeFormat);
if (date.isBefore(self.minDate) || date.isAfter(self.maxDate)) return;
self.startDateInput.value = changeCard.obsDateInput.value; self.startDateInput.value = changeCard.obsDateInput.value;
self.startTimeInput.value = changeCard.obsTimeInput.value; self.startTimeInput.value = changeCard.obsTimeInput.value;
self.updateFromStartDate(); self.updateFromStartDate();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment