diff --git a/client/client/src/greuge-create/greuge-create.html b/client/client/src/greuge-create/greuge-create.html
index 9bc8830dd..d89891acd 100644
--- a/client/client/src/greuge-create/greuge-create.html
+++ b/client/client/src/greuge-create/greuge-create.html
@@ -11,7 +11,7 @@
Add Greuge
-
+
diff --git a/client/core/src/datePicker/datePicker.js b/client/core/src/datePicker/datePicker.js
index 26fba6c34..936eae2db 100644
--- a/client/core/src/datePicker/datePicker.js
+++ b/client/core/src/datePicker/datePicker.js
@@ -18,12 +18,15 @@ export const formatEquivalence = {
};
class DatePicker extends Component {
- constructor($element, $translate, $filter, $timeout) {
+ constructor($element, $translate, $filter, $timeout, $attrs, $scope) {
super($element);
this.input = $element[0].querySelector('input');
this.$translate = $translate;
this.$filter = $filter;
this.$timeout = $timeout;
+ this.$attrs = $attrs;
+ this.$scope = $scope;
+
this.enabled = true;
this._modelView = null;
this._model = undefined;
@@ -168,6 +171,11 @@ class DatePicker extends Component {
}
);
}
+
+ if (this.$attrs.hasOwnProperty('today')) {
+ this.iniOptions.defaultDate = new Date();
+ }
+
this._optionsChecked = true;
return this.iniOptions;
}
@@ -176,6 +184,9 @@ class DatePicker extends Component {
this.iniOptions = this._getOptions();
this.isTimePicker = (this.iniOptions && this.iniOptions.enableTime && this.iniOptions.noCalendar);
this.vp = new Flatpickr(this.input, this.iniOptions);
+ if (this.iniOptions.defaultDate) {
+ this.modelView = this.vp.formatDate(this.iniOptions.defaultDate, this.iniOptions.dateFormat);
+ }
}
destroyPicker() {
if (this.vp)
@@ -191,7 +202,7 @@ class DatePicker extends Component {
this.destroyPicker();
}
}
-DatePicker.$inject = ['$element', '$translate', '$filter', '$timeout'];
+DatePicker.$inject = ['$element', '$translate', '$filter', '$timeout', '$attrs', '$scope'];
module.component('vnDatePicker', {
template: require('./datePicker.html'),