How to configure jQuery UI Datepicker to use localized calendar?

I wonder if this is possible, and if so, how do I do it? I am trying to get the widget to use the Jalali (Persian) calder.

+7
source share
3 answers

There is not much solution, although not complete, but I just found this nice implementation , the article is in Persian, but the author implements jQuery UI datepicker with both the Persian and Arabic calendar.

EDIT 9/6/2013:

Another contribution to Github , I like this implementation better, as it saves me from having to read the values โ€‹โ€‹of a collection of forms and do dodgy string manipulations to convert the date.

+2
source

jQuery UI

In general, to add localization to jQuery UI Datepicker, you need to include a specific localization file right after the Datepicker script is included. For example, to set French localization, you must do the following:

[...include jQuery and jQuery UI...] <script type="text/javascript" src="jquery.ui.datepicker-fr.js"></script> 

Localization files are included in the standard jQuery UI download in a separate directory ( development-bundle/ui/i18n ). For more information, see the Datepicker API Documentation (in the "Localization" section).

Current Status: Farsi in, Jalali out

Currently, the jQuery UI download package does not seem to contain a Jalali localization file. At the moment, it seems that only the regular (Georgian) calendar has been translated into Farsi ( jquery.ui.datepicker-fr.js ).

Solution 1 - custom localization file

If you prefer to use the jQuery UI datepicker, you can create your own localization file based on the format of existing localization files. If you are familiar with the calendar in question, this should not be difficult.

Solution 2 - use a different plugin

Consider the jQuery Calendars plugin instead. It already includes most of the worldโ€™s public calendars in several languages โ€‹โ€‹and formats , so the creation of Jalali or any other foreign calendar, for that matter, is done by clicking the settings.

+2
source

Maybe it's too late, but since I stumbled upon this, here is a demo that someone was kind enough to put up with. All credits to an unknown author http://jquery-ui.googlecode.com/svn/tags/1.6rc5/demos/datepicker/localization.html

0
source

All Articles