How to use the flatpickr.localize 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 graphhopper / graphhopper / web / src / main / resources / assets / js / main-template.js View on Github external
var language_code = urlParams.locale && urlParams.locale.split('-', 1)[0];
    if (language_code != 'en') {
        // A few language codes are different in GraphHopper and Flatpickr.
        var flatpickr_locale;
        switch (language_code) {
            case 'ca':  // Catalan
                flatpickr_locale = 'cat';
                break;
            case 'el':  // Greek
                flatpickr_locale = 'gr';
                break;
            default:
                flatpickr_locale = language_code;
        }
        if (Flatpickr.l10ns.hasOwnProperty(flatpickr_locale)) {
            Flatpickr.localize(Flatpickr.l10ns[flatpickr_locale]);
        }
    }

    $(window).resize(function () {
        mapLayer.adjustMapSize();
    });
    $("#locationpoints").sortable({
        items: ".pointDiv",
        cursor: "n-resize",
        containment: "parent",
        handle: ".pointFlag",
        update: function (event, ui) {
            var origin_index = $(ui.item[0]).data('index');
            sortable_items = $("#locationpoints > div.pointDiv");
            $(sortable_items).each(function (index) {
                var data_index = $(this).data('index');
github laravel-enso / forms / src / resources / js / components / enso / vueforms / Datepicker.vue View on Github external
locale(locale) {
            this.destroy();
            Flatpickr.localize(i18n[locale]);
            this.init();
        },
        min() {
github TrestleAdmin / trestle / frontend / js / core / i18n.js View on Github external
export function localize () {
  for (var i = 0; i < arguments.length; ++i) {
    var locale = arguments[i]
    var flatpickrLocale = FlatpickrLocaleConversions[locale] || locale

    if (flatpickr.l10ns[flatpickrLocale]) {
      flatpickr.localize(flatpickr.l10ns[flatpickrLocale])
      break
    }
  }
}
github Enalean / tuleap / src / www / themes / common / tlp / src / index.fr_FR.js View on Github external
import flatpickr from "flatpickr";
import { French } from "flatpickr/dist/l10n/fr.js";

export * from "./js/index.js";

import "../node_modules/select2/dist/js/i18n/fr.js";

import locale from "./vendor-i18n/fr_FR/tlp.fr.js";
import overrideSelect2 from "./vendor-overrides/select2.js";

flatpickr.localize(French);

function frenchSelect2(element, options) {
    options.language = options.language || locale;

    return overrideSelect2(element, options);
}

export { locale, frenchSelect2 as select2 };
github adr1enbe4udou1n / laravel-boilerplate / resources / assets / js / plugins.js View on Github external
(function ($) {
  window.locale = $('html').attr('lang')

  if (window.locale !== 'en') {
    flatpickr.localize(require(`flatpickr/dist/l10n/${window.locale}`)[window.locale])
  }

  /**
     * Place the CSRF token as a header on all pages for access in AJAX requests
     */
  $.ajaxSetup({
    headers: {
      'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
  })

  /**
   * Swal confirm dialog
   */
  $.confirmSwal = (target, callback) => {
    window.swal({