bug fixed in datePicker
This commit is contained in:
parent
e52b31ceb3
commit
80bbd9e5d4
|
@ -37,7 +37,8 @@ class DatePicker extends Component {
|
||||||
set model(value) {
|
set model(value) {
|
||||||
this._model = value;
|
this._model = value;
|
||||||
if (value && !this.modelView) {
|
if (value && !this.modelView) {
|
||||||
let format = this._formatFlat2Angular(this.iniOptions.dateFormat || 'Y-m-d');
|
let initialDateFormat = (this.iniOptions && this.iniOptions.dateFormat) ? this.iniOptions.dateFormat : 'Y-m-d';
|
||||||
|
let format = this._formatFlat2Angular(initialDateFormat);
|
||||||
this.modelView = this.$filter('date')(value, format);
|
this.modelView = this.$filter('date')(value, format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -83,7 +84,7 @@ class DatePicker extends Component {
|
||||||
let model;
|
let model;
|
||||||
if (!value) {
|
if (!value) {
|
||||||
model = undefined;
|
model = undefined;
|
||||||
} else if (!this.iniOptions.dateFormat || (this.iniOptions.dateFormat && this.iniOptions.dateFormat.startsWith('Y-m-d'))) {
|
} else if (!this.iniOptions || (this.iniOptions.dateFormat && this.iniOptions.dateFormat.startsWith('Y-m-d'))) {
|
||||||
model = value;
|
model = value;
|
||||||
} else {
|
} else {
|
||||||
let formats = this.iniOptions.dateFormat.split(/[ZT.,/ :-]/);
|
let formats = this.iniOptions.dateFormat.split(/[ZT.,/ :-]/);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<vn-vertical pad-large>
|
<vn-vertical pad-large>
|
||||||
<vn-title>Create Route</vn-title>
|
<vn-title>Create Route</vn-title>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
<vn-date-picker vn-one label="Date" field="$ctrl.delivery.date"></vn-date-picker>
|
<vn-date-picker vn-one label="Date" model="$ctrl.delivery.date"></vn-date-picker>
|
||||||
<vn-textfield vn-one label="Agency" field="$ctrl.delivery.agency"></vn-textfield>
|
<vn-textfield vn-one label="Agency" field="$ctrl.delivery.agency"></vn-textfield>
|
||||||
</vn-horizontal>
|
</vn-horizontal>
|
||||||
<vn-horizontal>
|
<vn-horizontal>
|
||||||
|
|
Loading…
Reference in New Issue