-
I'm using rails 7 and using importmap stimulus |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
if you all want to use locale and import map you could do this instead import the file use unpkg because its more complete than the jspm counterpart for indonesian the command is
and then in ur javascript files add then you could do it like in the docs here is my final stimulus controller files import { Controller } from "@hotwired/stimulus"
import flatpickr from 'flatpickr';
import confirmDatePlugin from "flatpickr/dist/plugins/confirmDate/confirmDate"
import "flatpickr/dist/l10n/id.js"
export default class extends Controller {
connect() {
flatpickr(this.element, {
"plugins": [new confirmDatePlugin({
confirmText: "OK",
showAlways: false,
theme: "light"
})],
locale: "id",
altInput: true,
altFormat: "l, j F Y H:i",
dateFormat: "Z",
enableTime: true,
time_24hr: true
});
}
} |
Beta Was this translation helpful? Give feedback.
-
If it helps anyone, this was my setup for flatpickr in rails as of 21/02/2024:
|
Beta Was this translation helpful? Give feedback.
if you all want to use locale and import map you could do this instead
import the file use unpkg because its more complete than the jspm counterpart
for indonesian the command is
and then in ur javascript files add
import "flatpickr/dist/l10n/id.js"
then you could do it like in the docs
here is my final stimulus controller files