Sha256: 083bef50b9b62be40f7cda807120f991de49113d0aec6630792a1479de9f249a
Contents?: true
Size: 840 Bytes
Versions: 2
Compression:
Stored size: 840 Bytes
Contents
import {Controller} from "@hotwired/stimulus" import flatpickr from "flatpickr"; import {Dutch} from "flatpickr/dist/l10n/nl.js" export default class extends Controller { static get targets() { return ["input"] } connect() { const options = {...this.defaultOptions(), ...this.options()} flatpickr(this.inputTarget, options); } options() { return JSON.parse(this.inputTarget.getAttribute('data-flatpickr-options')) } 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
headmin-0.2.9 | src/js/headmin/controllers/flatpickr_controller.js |
headmin-0.2.8 | src/js/headmin/controllers/flatpickr_controller.js |