#1223 Añadir offset de hora a componente vn-input-time
gitea/salix/master This commit looks good
Details
gitea/salix/master This commit looks good
Details
This commit is contained in:
parent
ce71c56944
commit
60d43a795d
|
@ -6,7 +6,7 @@
|
||||||
<input
|
<input
|
||||||
class="mdl-textfield__input"
|
class="mdl-textfield__input"
|
||||||
type="time"
|
type="time"
|
||||||
ng-model="$ctrl.value"
|
ng-model="$ctrl.model"
|
||||||
vn-validation="{{$ctrl.rule}}"
|
vn-validation="{{$ctrl.rule}}"
|
||||||
ng-disabled="$ctrl.disabled"
|
ng-disabled="$ctrl.disabled"
|
||||||
ng-readonly="$ctrl.readonly"
|
ng-readonly="$ctrl.readonly"
|
||||||
|
|
|
@ -3,11 +3,19 @@ import Textfield from '../textfield/textfield';
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
export default class InputTime extends Textfield {
|
export default class InputTime extends Textfield {
|
||||||
|
|
||||||
get value() {
|
get value() {
|
||||||
return this._value;
|
return this._value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get model() {
|
||||||
|
return this._model;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
set model(value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
set value(value) {
|
set value(value) {
|
||||||
if (!value) return;
|
if (!value) return;
|
||||||
|
|
||||||
|
@ -15,7 +23,15 @@ export default class InputTime extends Textfield {
|
||||||
newDate.setSeconds(0);
|
newDate.setSeconds(0);
|
||||||
newDate.setMilliseconds(0);
|
newDate.setMilliseconds(0);
|
||||||
|
|
||||||
this._value = newDate;
|
this._model = newDate;
|
||||||
|
this.hasValue = this._model !== null;
|
||||||
|
|
||||||
|
let date = new Date(value);
|
||||||
|
date.setSeconds(0);
|
||||||
|
date.setMilliseconds(0);
|
||||||
|
let offset = date.getTimezoneOffset() * 60000;
|
||||||
|
date.setTime(date.getTime() - offset);
|
||||||
|
this._value = date;
|
||||||
|
|
||||||
this.hasValue = this._value !== null;
|
this.hasValue = this._value !== null;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue