How to use the jquery-ui/ui/widgets/datepicker.setDefaults function in jquery-ui

To help you get started, we’ve selected a few jquery-ui 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 synyx / urlaubsverwaltung / src / main / webapp / components / filter-modal / index.js View on Github external
$(document).ready(async function () {

  const locale = window.navigator.language;
  if (locale === 'de') {
    const de = await import('jquery-ui/ui/i18n/datepicker-de');
    datepicker.setDefaults({
      ...de,
      weekHeader: 'Wo'
    });
  }
  else {
    const en = await import('jquery-ui/ui/i18n/datepicker-en-GB');
    datepicker.setDefaults({
      ...en,
      dateFormat: 'dd.mm.yy'
    });
  }

  $('#startDate').datepicker();
  $('#endDate').datepicker();
});

jquery-ui

A curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library.

MIT
Latest version published 2 years ago

Package Health Score

77 / 100
Full package analysis