diff --git a/client/core/src/datePicker/datePicker.js b/client/core/src/datePicker/datePicker.js
index 43f34d9df..5380eda6b 100644
--- a/client/core/src/datePicker/datePicker.js
+++ b/client/core/src/datePicker/datePicker.js
@@ -37,7 +37,8 @@ class DatePicker extends Component {
set model(value) {
this._model = value;
if (value && !this.modelView) {
- let initialDateFormat = (this.iniOptions && this.iniOptions.dateFormat) ? this.iniOptions.dateFormat : 'Y-m-d';
+ let options = this._getOptions();
+ let initialDateFormat = (options && options.dateFormat) ? options.dateFormat : 'Y-m-d';
let format = this._formatFlat2Angular(initialDateFormat);
this.modelView = this.$filter('date')(value, format);
}
@@ -135,31 +136,37 @@ class DatePicker extends Component {
}
}
- $onInit() {
- if (!this.iniOptions)
- this.iniOptions = {};
+ _getOptions() {
+ if (this.iniOptions) {
+ return this.iniOptions;
+ }
- if (!this.iniOptions.locale)
- this.iniOptions.locale = this.$translate.use();
+ let iniOptions = {};
+ if (!iniOptions.locale)
+ iniOptions.locale = this.$translate.use();
- if (!this.iniOptions.dateFormat && this.iniOptions.locale === 'es')
- this.iniOptions.dateFormat = 'd-m-Y';
- else if (this.iniOptions.dateFormat) {
- let format = this.iniOptions.dateFormat.split(/[ZT.,/ :-]/);
+ if (!iniOptions.dateFormat && iniOptions.locale === 'es')
+ iniOptions.dateFormat = 'd-m-Y';
+ else if (iniOptions.dateFormat) {
+ let format = iniOptions.dateFormat.split(/[ZT.,/ :-]/);
if (format.length <= 1) {
throw new Error(`Error: Invalid string format ${format}`);
}
format.forEach(
val => {
if (!formatEquivalence[val]) {
- throw new Error(`Error in dateFormat ${this.iniOptions.dateFormat}: is not like Flatpickr Formatting Token https://chmln.github.io/flatpickr/formatting/`);
+ throw new Error(`Error in dateFormat ${iniOptions.dateFormat}: is not like Flatpickr Formatting Token https://chmln.github.io/flatpickr/formatting/`);
}
}
);
}
+ return iniOptions;
+ }
- if (this.input)
- this.vp = new Flatpickr(this.input, this.iniOptions);
+ $onInit() {
+ this.iniOptions = this._getOptions();
+
+ this.vp = new Flatpickr(this.input, this.iniOptions);
}
$onDestroy() {
if (this.vp)
diff --git a/client/route/src/basic-data/basic-data.html b/client/route/src/basic-data/basic-data.html
index 007163034..859633e31 100644
--- a/client/route/src/basic-data/basic-data.html
+++ b/client/route/src/basic-data/basic-data.html
@@ -1,3 +1,9 @@
+