adt-js-components 1.0.6 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "adt-js-components",
3
- "version": "1.0.6",
3
+ "version": "1.0.9",
4
4
  "description": "JavaScript components for Nette framework",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -20,7 +20,7 @@ const init = (selector, path) => {
20
20
  loadedComponents.push(path);
21
21
 
22
22
  if (path.includes('/')) {
23
- import('app/' + path + '/index.js').then(component => {
23
+ import(path + '/index.js').then(component => {
24
24
  component.default.run(componentsConfig[selector] || {});
25
25
  });
26
26
 
@@ -15,13 +15,21 @@ function initTime(input, options) {
15
15
  });
16
16
  }
17
17
 
18
- function initDate(input, options) {
18
+ async function initDate(input, options) {
19
+ if (locale === 'en') {
20
+ options.locale = null;
21
+ } else if (locale === 'el') {
22
+ options.locale = 'gr';
23
+ } else {
24
+ options.locale = locale;
25
+ }
26
+
19
27
  flatpickr(input, {
20
28
  dateFormat: options.format, // default datetime-local
21
29
  enableTime: options.type === 'datetime' || options.type === 'datetime-local',
22
30
  time_24hr: true,
23
- locale: require(`flatpickr/dist/l10n/${locale}.js`).default[locale],
24
- defaultDate: options.value,
31
+ locale: options.locale ? require('flatpickr/dist/l10n/' + options.locale + '.js').default[options.locale] : null,
32
+ defaultDate: options.value ? new Date(options.value) : null,
25
33
  minDate: options.minDate ? new Date(options.minDate) : null,
26
34
  maxDate: options.maxDate ? new Date(options.maxDate) : null
27
35
  });