Sha256: c84a5d2f149a79982c57361a2ad1c00ef3ce84f365b053bbadba7e29e41a6779
Contents?: true
Size: 726 Bytes
Versions: 30
Compression:
Stored size: 726 Bytes
Contents
import { Controller } from '@hotwired/stimulus' import flatpickr from 'flatpickr' import { Dutch } from 'flatpickr/dist/esm/l10n/nl.js' import I18n from '../config/i18n' export default class extends Controller { connect () { const options = { ...this.defaultOptions(), ...this.options() } flatpickr(this.element, options) } options () { return JSON.parse(this.element.getAttribute('data-flatpickr')) } defaultOptions () { return { allowInput: true, dateFormat: 'd/m/Y', locale: this.getLocale(I18n.locale) } } getLocale (locale) { const locales = this.locales() return locales[locale] } locales () { return { en: null, nl: Dutch } } }
Version data entries
30 entries across 30 versions & 2 rubygems