#921 componete datepicker

This commit is contained in:
Gerard 2018-12-21 14:14:46 +01:00
parent 48566f647c
commit 34905c616a
2 changed files with 10 additions and 2 deletions

View File

@ -12,7 +12,7 @@
<div class="mdl-chip__action"> <div class="mdl-chip__action">
<i <i
class="material-icons pointer" class="material-icons pointer"
ng-show="$ctrl.enabled && $ctrl.model && ($ctrl.hasFocus || $ctrl.hasMouseIn)" ng-show="!$ctrl.disabled && $ctrl.model && ($ctrl.hasFocus || $ctrl.hasMouseIn)"
ng-click="$ctrl.onClear()"> ng-click="$ctrl.onClear()">
clear clear
</i> </i>

View File

@ -29,7 +29,7 @@ class DatePicker extends Component {
if (this.vp.selectedDates.length) { if (this.vp.selectedDates.length) {
let date = this.vp.selectedDates[0]; let date = this.vp.selectedDates[0];
if (!this.isLocale && !this._iniOptions.enableTime) { if (!this.isLocale && !this._iniOptions.enableTime && !this.iniOptions.onlyDate) {
let now = new Date(); let now = new Date();
date.setTime(date.getTime() date.setTime(date.getTime()
+ now.getHours() * 60 * 60 * 1000 + now.getHours() * 60 * 60 * 1000
@ -38,7 +38,15 @@ class DatePicker extends Component {
+ now.getUTCMilliseconds() + now.getUTCMilliseconds()
); );
} }
console.log(this.iniOptions);
if (this.iniOptions.onlyDate) {
let now = new Date();
let offset = now.getTimezoneOffset() * 60000;
date.setHours(0, 0, 0, 0);
date.setTime(date.getTime() - offset);
}
console.log(date);
this._model = date; this._model = date;
} else } else
this.model = null; this.model = null;