How to use the flatpickr/dist/l10n/fr.js.fr function in flatpickr

To help you get started, we’ve selected a few flatpickr examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github opendigitaleducation / entcore / admin / src / main / ts / app / shared / ux / components / datepicker.component.ts View on Github external
ngAfterViewInit(): void {
        // add attr data-input, mandatory for the picker to work in wrap mode
        this.renderer.setElementAttribute(this.inputElement.nativeElement, 'data-input', '');

        // disabled case
        if (this.disabled === true) {
            this.model.control.disable()
        }

        const navigatorLanguage = navigator.language.split('-')[0];
        let datePickerLocale = {};
        if (navigatorLanguage === 'fr') {
            datePickerLocale = French.fr;
        }

        // options for the flatpickr instance
        let options = {
            altInput: !this.disabled,
            altFormat: 'd/m/Y', // date format displayed to user
            dateFormat: 'Y-m-d', // date format sent to server
            allowInput: false,
            enableTime: this.enableTime,
            minDate: this.minDate,
            maxDate: this.maxDate,
            clickOpens: !this.disabled,
            wrap: true, // to add input decoration (calendar icon and delete icon)
            locale: datePickerLocale
        }