diff --git a/front/core/components/date-picker/date-picker.js b/front/core/components/date-picker/date-picker.js index e4bd24422..80a8072ad 100644 --- a/front/core/components/date-picker/date-picker.js +++ b/front/core/components/date-picker/date-picker.js @@ -28,14 +28,8 @@ class DatePicker extends Component { onValueUpdate() { if (this.vp.selectedDates.length) { let date = this.vp.selectedDates[0]; - - if (!this.isLocale && !this._iniOptions.enableTime) { - let now = new Date(); - - let offset = now.getTimezoneOffset() * 60000; - date.setHours(0, 0, 0, 0); - date.setTime(date.getTime() - offset); - } + let offset = date.getTimezoneOffset() * 60000; + date.setTime(date.getTime() - offset); this._model = date; } else this.model = null; @@ -67,8 +61,16 @@ class DatePicker extends Component { set model(value) { this._model = value; - this.dateValue = value ? new Date(value) : null; - this.vp.setDate(this.dateValue); + this.dateValue = value; + let date; + if (value && this.iniOptions.enableTime) { + date = new Date(value); + let offset = date.getTimezoneOffset() * 60000; + date.setTime(date.getTime() + offset); + } else + date = value; + + this.vp.setDate(date); this.mdlUpdate(); } @@ -84,6 +86,7 @@ class DatePicker extends Component { $onDestroy() { this.vp.destroy(); + this.dateValue = undefined; } } DatePicker.$inject = ['$element', '$scope', '$translate', '$attrs']; @@ -91,12 +94,12 @@ DatePicker.$inject = ['$element', '$scope', '$translate', '$attrs']; ngModule.component('vnDatePicker', { template: require('./date-picker.html'), bindings: { + iniOptions: ' { this.execute(query, params, options, (error, response) => { if (cb) diff --git a/modules/order/back/models/order.json b/modules/order/back/models/order.json index 0ae4dfd7b..ab10ad194 100644 --- a/modules/order/back/models/order.json +++ b/modules/order/back/models/order.json @@ -13,7 +13,7 @@ "description": "Identifier" }, "landed": { - "type": "date", + "type": "Date", "required": true, "mysql": { "columnName": "date_send" @@ -63,19 +63,19 @@ } }, "created": { - "type": "date", + "type": "Date", "mysql": { "columnName": "date_make" } }, "firstRowStamp": { - "type": "date", + "type": "Date", "mysql": { "columnName": "first_row_stamp" } }, "confirmed": { - "type": "date", + "type": "Date", "mysql": { "columnName": "confirm_date" } diff --git a/modules/ticket/back/models/ticket.json b/modules/ticket/back/models/ticket.json index bd8917f8d..1b44745b9 100644 --- a/modules/ticket/back/models/ticket.json +++ b/modules/ticket/back/models/ticket.json @@ -13,11 +13,11 @@ "description": "Identifier" }, "shipped": { - "type": "date", + "type": "Date", "required": true }, "landed": { - "type": "date" + "type": "Date" }, "nickname": { "type": "String" @@ -32,7 +32,7 @@ "type": "Number" }, "created": { - "type": "date" + "type": "Date" }, "isDeleted": { "type": "boolean"