aurelia-bootstrap-datetimepicker
Advanced tools
Comparing version 1.3.4 to 1.3.5
@@ -134,7 +134,4 @@ define(['exports', 'aurelia-framework', 'moment', 'jquery', './picker-global-options', 'eonasdan-bootstrap-datetimepicker'], function (exports, _aureliaFramework, _moment, _jquery, _pickerGlobalOptions) { | ||
if ((0, _moment2.default)(e.date, _this2._format, true).isValid()) { | ||
var date = _this2.getDateWhenValid(e.date, _this2.value); | ||
if (date) { | ||
_this2.model = date.toDate(); | ||
_this2.value = date; | ||
} | ||
_this2.model = (0, _moment2.default)(e.date, _this2._format, true).toDate(); | ||
_this2.value = (0, _moment2.default)(e.date, _this2._format, true).format(_this2._format); | ||
} else if (!e.date) { | ||
@@ -210,7 +207,4 @@ _this2.model = null; | ||
if (value && (0, _moment2.default)(value, this._format, true).isValid()) { | ||
var date = this.getDateWhenValid(value, this.value); | ||
if (date) { | ||
this.model = date.toDate(); | ||
this.value = date; | ||
} | ||
this.model = (0, _moment2.default)(value, this._format, true).toDate(); | ||
this.value = (0, _moment2.default)(value, this._format, true).format(this._format); | ||
} | ||
@@ -322,9 +316,8 @@ }; | ||
AbpDatetimePickerCustomElement.prototype.modelChanged = function modelChanged(newValue, oldValue) { | ||
if (!(0, _moment2.default)(newValue, this._format, true).isValid() && newValue !== null) { | ||
if (!(0, _moment2.default)(newValue).isValid() && newValue !== null) { | ||
throw new Error('Datetimepicker, model.bind must be of type Date'); | ||
} | ||
if (newValue !== oldValue && newValue) { | ||
var date = this.getDateWhenValid(newValue, oldValue); | ||
if (date) { | ||
this.value = date; | ||
if (!oldValue || (0, _moment2.default)(oldValue).isValid() && !(0, _moment2.default)(oldValue).isSame()) { | ||
this.value = (0, _moment2.default)(newValue).format(this._format); | ||
} | ||
@@ -348,3 +341,5 @@ } | ||
if ((0, _moment2.default)(newValue, this._format, true).isValid()) { | ||
this.model = (0, _moment2.default)(newValue, this._format, true).toDate(); | ||
if (!oldValue || (0, _moment2.default)(oldValue, this._format, true).isValid() && !(0, _moment2.default)(oldValue, this._format, true).isSame()) { | ||
this.model = (0, _moment2.default)(newValue, this._format, true).toDate(); | ||
} | ||
} | ||
@@ -363,13 +358,2 @@ } | ||
AbpDatetimePickerCustomElement.prototype.getDateWhenValid = function getDateWhenValid(newValue, oldValue) { | ||
if ((0, _moment2.default)(newValue, this._format, true).isValid()) { | ||
var newDate = (0, _moment2.default)(newValue, this._format, true); | ||
if (!oldValue || (0, _moment2.default)(this.value, this._format, true).isValid() && !newDate.isSame(this.value)) { | ||
return newDate; | ||
} | ||
} | ||
return null; | ||
}; | ||
return AbpDatetimePickerCustomElement; | ||
@@ -376,0 +360,0 @@ }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'element', [_dec2], { |
@@ -135,7 +135,4 @@ 'use strict'; | ||
if ((0, _moment2.default)(e.date, _this2._format, true).isValid()) { | ||
var date = _this2.getDateWhenValid(e.date, _this2.value); | ||
if (date) { | ||
_this2.model = date.toDate(); | ||
_this2.value = date; | ||
} | ||
_this2.model = (0, _moment2.default)(e.date, _this2._format, true).toDate(); | ||
_this2.value = (0, _moment2.default)(e.date, _this2._format, true).format(_this2._format); | ||
} else if (!e.date) { | ||
@@ -211,7 +208,4 @@ _this2.model = null; | ||
if (value && (0, _moment2.default)(value, this._format, true).isValid()) { | ||
var date = this.getDateWhenValid(value, this.value); | ||
if (date) { | ||
this.model = date.toDate(); | ||
this.value = date; | ||
} | ||
this.model = (0, _moment2.default)(value, this._format, true).toDate(); | ||
this.value = (0, _moment2.default)(value, this._format, true).format(this._format); | ||
} | ||
@@ -323,9 +317,8 @@ }; | ||
AbpDatetimePickerCustomElement.prototype.modelChanged = function modelChanged(newValue, oldValue) { | ||
if (!(0, _moment2.default)(newValue, this._format, true).isValid() && newValue !== null) { | ||
if (!(0, _moment2.default)(newValue).isValid() && newValue !== null) { | ||
throw new Error('Datetimepicker, model.bind must be of type Date'); | ||
} | ||
if (newValue !== oldValue && newValue) { | ||
var date = this.getDateWhenValid(newValue, oldValue); | ||
if (date) { | ||
this.value = date; | ||
if (!oldValue || (0, _moment2.default)(oldValue).isValid() && !(0, _moment2.default)(oldValue).isSame()) { | ||
this.value = (0, _moment2.default)(newValue).format(this._format); | ||
} | ||
@@ -349,3 +342,5 @@ } | ||
if ((0, _moment2.default)(newValue, this._format, true).isValid()) { | ||
this.model = (0, _moment2.default)(newValue, this._format, true).toDate(); | ||
if (!oldValue || (0, _moment2.default)(oldValue, this._format, true).isValid() && !(0, _moment2.default)(oldValue, this._format, true).isSame()) { | ||
this.model = (0, _moment2.default)(newValue, this._format, true).toDate(); | ||
} | ||
} | ||
@@ -364,13 +359,2 @@ } | ||
AbpDatetimePickerCustomElement.prototype.getDateWhenValid = function getDateWhenValid(newValue, oldValue) { | ||
if ((0, _moment2.default)(newValue, this._format, true).isValid()) { | ||
var newDate = (0, _moment2.default)(newValue, this._format, true); | ||
if (!oldValue || (0, _moment2.default)(this.value, this._format, true).isValid() && !newDate.isSame(this.value)) { | ||
return newDate; | ||
} | ||
} | ||
return null; | ||
}; | ||
return AbpDatetimePickerCustomElement; | ||
@@ -377,0 +361,0 @@ }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'element', [_dec2], { |
@@ -109,7 +109,4 @@ var _dec, _dec2, _dec3, _dec4, _class, _desc, _value, _class2, _descriptor, _descriptor2, _descriptor3, _descriptor4, _descriptor5, _descriptor6, _descriptor7, _descriptor8, _descriptor9, _descriptor10, _descriptor11, _descriptor12, _descriptor13, _descriptor14, _descriptor15; | ||
if (moment(e.date, this._format, true).isValid()) { | ||
const date = this.getDateWhenValid(e.date, this.value); | ||
if (date) { | ||
this.model = date.toDate(); | ||
this.value = date; | ||
} | ||
this.model = moment(e.date, this._format, true).toDate(); | ||
this.value = moment(e.date, this._format, true).format(this._format); | ||
} else if (!e.date) { | ||
@@ -185,7 +182,4 @@ this.model = null; | ||
if (value && moment(value, this._format, true).isValid()) { | ||
const date = this.getDateWhenValid(value, this.value); | ||
if (date) { | ||
this.model = date.toDate(); | ||
this.value = date; | ||
} | ||
this.model = moment(value, this._format, true).toDate(); | ||
this.value = moment(value, this._format, true).format(this._format); | ||
} | ||
@@ -291,9 +285,8 @@ } | ||
modelChanged(newValue, oldValue) { | ||
if (!moment(newValue, this._format, true).isValid() && newValue !== null) { | ||
if (!moment(newValue).isValid() && newValue !== null) { | ||
throw new Error('Datetimepicker, model.bind must be of type Date'); | ||
} | ||
if (newValue !== oldValue && newValue) { | ||
const date = this.getDateWhenValid(newValue, oldValue); | ||
if (date) { | ||
this.value = date; | ||
if (!oldValue || moment(oldValue).isValid() && !moment(oldValue).isSame()) { | ||
this.value = moment(newValue).format(this._format); | ||
} | ||
@@ -317,3 +310,5 @@ } | ||
if (moment(newValue, this._format, true).isValid()) { | ||
this.model = moment(newValue, this._format, true).toDate(); | ||
if (!oldValue || moment(oldValue, this._format, true).isValid() && !moment(oldValue, this._format, true).isSame()) { | ||
this.model = moment(newValue, this._format, true).toDate(); | ||
} | ||
} | ||
@@ -331,13 +326,2 @@ } | ||
} | ||
getDateWhenValid(newValue, oldValue) { | ||
if (moment(newValue, this._format, true).isValid()) { | ||
const newDate = moment(newValue, this._format, true); | ||
if (!oldValue || moment(this.value, this._format, true).isValid() && !newDate.isSame(this.value)) { | ||
return newDate; | ||
} | ||
} | ||
return null; | ||
} | ||
}, (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'element', [_dec2], { | ||
@@ -344,0 +328,0 @@ enumerable: true, |
@@ -136,7 +136,4 @@ 'use strict'; | ||
if (moment(e.date, _this2._format, true).isValid()) { | ||
var date = _this2.getDateWhenValid(e.date, _this2.value); | ||
if (date) { | ||
_this2.model = date.toDate(); | ||
_this2.value = date; | ||
} | ||
_this2.model = moment(e.date, _this2._format, true).toDate(); | ||
_this2.value = moment(e.date, _this2._format, true).format(_this2._format); | ||
} else if (!e.date) { | ||
@@ -212,7 +209,4 @@ _this2.model = null; | ||
if (value && moment(value, this._format, true).isValid()) { | ||
var date = this.getDateWhenValid(value, this.value); | ||
if (date) { | ||
this.model = date.toDate(); | ||
this.value = date; | ||
} | ||
this.model = moment(value, this._format, true).toDate(); | ||
this.value = moment(value, this._format, true).format(this._format); | ||
} | ||
@@ -324,9 +318,8 @@ }; | ||
AbpDatetimePickerCustomElement.prototype.modelChanged = function modelChanged(newValue, oldValue) { | ||
if (!moment(newValue, this._format, true).isValid() && newValue !== null) { | ||
if (!moment(newValue).isValid() && newValue !== null) { | ||
throw new Error('Datetimepicker, model.bind must be of type Date'); | ||
} | ||
if (newValue !== oldValue && newValue) { | ||
var date = this.getDateWhenValid(newValue, oldValue); | ||
if (date) { | ||
this.value = date; | ||
if (!oldValue || moment(oldValue).isValid() && !moment(oldValue).isSame()) { | ||
this.value = moment(newValue).format(this._format); | ||
} | ||
@@ -350,3 +343,5 @@ } | ||
if (moment(newValue, this._format, true).isValid()) { | ||
this.model = moment(newValue, this._format, true).toDate(); | ||
if (!oldValue || moment(oldValue, this._format, true).isValid() && !moment(oldValue, this._format, true).isSame()) { | ||
this.model = moment(newValue, this._format, true).toDate(); | ||
} | ||
} | ||
@@ -365,13 +360,2 @@ } | ||
AbpDatetimePickerCustomElement.prototype.getDateWhenValid = function getDateWhenValid(newValue, oldValue) { | ||
if (moment(newValue, this._format, true).isValid()) { | ||
var newDate = moment(newValue, this._format, true); | ||
if (!oldValue || moment(this.value, this._format, true).isValid() && !newDate.isSame(this.value)) { | ||
return newDate; | ||
} | ||
} | ||
return null; | ||
}; | ||
return AbpDatetimePickerCustomElement; | ||
@@ -378,0 +362,0 @@ }(), (_descriptor = _applyDecoratedDescriptor(_class2.prototype, 'element', [_dec2], { |
{ | ||
"name": "aurelia-bootstrap-datetimepicker", | ||
"version": "1.3.4", | ||
"version": "1.3.5", | ||
"description": "An Aurelia Custom Element for the 3rd party addon [Eonasdan Bootstrap Datepicker]", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -67,7 +67,4 @@ import {inject, bindable, bindingMode, DOM} from 'aurelia-framework'; | ||
if (moment(e.date, this._format, true).isValid()) { | ||
const date = this.getDateWhenValid(e.date, this.value); | ||
if (date) { | ||
this.model = date.toDate(); | ||
this.value = date; | ||
} | ||
this.model = moment(e.date, this._format, true).toDate(); | ||
this.value = moment(e.date, this._format, true).format(this._format); | ||
} else if (!e.date) { | ||
@@ -149,7 +146,4 @@ this.model = null; | ||
if (value && moment(value, this._format, true).isValid()) { | ||
const date = this.getDateWhenValid(value, this.value); | ||
if (date) { | ||
this.model = date.toDate(); | ||
this.value = date; | ||
} | ||
this.model = moment(value, this._format, true).toDate(); | ||
this.value = moment(value, this._format, true).format(this._format); | ||
} | ||
@@ -317,9 +311,8 @@ } | ||
modelChanged(newValue, oldValue) { | ||
if (!moment(newValue, this._format, true).isValid() && newValue !== null) { | ||
if (!moment(newValue).isValid() && newValue !== null) { | ||
throw new Error('Datetimepicker, model.bind must be of type Date'); | ||
} | ||
if (newValue !== oldValue && newValue) { | ||
const date = this.getDateWhenValid(newValue, oldValue); | ||
if (date) { | ||
this.value = date; | ||
if (!oldValue || (moment(oldValue).isValid() && !moment(oldValue).isSame())) { | ||
this.value = moment(newValue).format(this._format); | ||
} | ||
@@ -343,3 +336,5 @@ } | ||
if (moment(newValue, this._format, true).isValid()) { | ||
this.model = moment(newValue, this._format, true).toDate(); | ||
if (!oldValue || (moment(oldValue, this._format, true).isValid() && !moment(oldValue, this._format, true).isSame())) { | ||
this.model = moment(newValue, this._format, true).toDate(); | ||
} | ||
} | ||
@@ -356,14 +351,2 @@ } | ||
} | ||
/** Pass a possible date value and if it's valid and not as previous date then return it */ | ||
getDateWhenValid(newValue, oldValue) { | ||
if (moment(newValue, this._format, true).isValid()) { | ||
const newDate = moment(newValue, this._format, true); | ||
if (!oldValue || (moment(this.value, this._format, true).isValid() && !newDate.isSame(this.value))) { | ||
return newDate; | ||
} | ||
} | ||
return null; | ||
} | ||
} |
115637
2066