Merge branch 'master' into test
gitea/salix/test This commit looks good Details

This commit is contained in:
Gerard 2019-03-15 07:41:47 +01:00
commit 496ac864c3
2 changed files with 19 additions and 3 deletions

View File

@ -6,7 +6,7 @@
<input
class="mdl-textfield__input"
type="time"
ng-model="$ctrl.value"
ng-model="$ctrl.model"
vn-validation="{{$ctrl.rule}}"
ng-disabled="$ctrl.disabled"
ng-readonly="$ctrl.readonly"

View File

@ -3,11 +3,19 @@ import Textfield from '../textfield/textfield';
import './style.scss';
export default class InputTime extends Textfield {
get value() {
return this._value;
}
get model() {
return this._model;
}
set model(value) {
this.value = value;
}
set value(value) {
if (!value) return;
@ -15,7 +23,15 @@ export default class InputTime extends Textfield {
newDate.setSeconds(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;