Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Support localized numbers in the jQuery Calendars plugin by Keith Wood (http://keith-wood.name/calendars.html)

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 README.md
Octocat-spinner-32 calendar-blue.gif
Octocat-spinner-32 calendar-green.gif
Octocat-spinner-32 calendar.gif
Octocat-spinner-32 calendarsBasic.html
Octocat-spinner-32 calendarsPickerBasic.html
Octocat-spinner-32 flora.calendars.picker.css
Octocat-spinner-32 humanity.calendars.picker.css
Octocat-spinner-32 jquery.calendars-af.js
Octocat-spinner-32 jquery.calendars-ar-DZ.js
Octocat-spinner-32 jquery.calendars-ar.js
Octocat-spinner-32 jquery.calendars-az.js
Octocat-spinner-32 jquery.calendars-bg.js
Octocat-spinner-32 jquery.calendars-bs.js
Octocat-spinner-32 jquery.calendars-ca.js
Octocat-spinner-32 jquery.calendars-cs.js
Octocat-spinner-32 jquery.calendars-da.js
Octocat-spinner-32 jquery.calendars-de-CH.js
Octocat-spinner-32 jquery.calendars-de.js
Octocat-spinner-32 jquery.calendars-el.js
Octocat-spinner-32 jquery.calendars-en-AU.js
Octocat-spinner-32 jquery.calendars-en-GB.js
Octocat-spinner-32 jquery.calendars-en-NZ.js
Octocat-spinner-32 jquery.calendars-eo.js
Octocat-spinner-32 jquery.calendars-es-AR.js
Octocat-spinner-32 jquery.calendars-es-PE.js
Octocat-spinner-32 jquery.calendars-es.js
Octocat-spinner-32 jquery.calendars-et.js
Octocat-spinner-32 jquery.calendars-eu.js
Octocat-spinner-32 jquery.calendars-fa.js
Octocat-spinner-32 jquery.calendars-fi.js
Octocat-spinner-32 jquery.calendars-fo.js
Octocat-spinner-32 jquery.calendars-fr-CH.js
Octocat-spinner-32 jquery.calendars-fr.js
Octocat-spinner-32 jquery.calendars-gl.js
Octocat-spinner-32 jquery.calendars-gu.js
Octocat-spinner-32 jquery.calendars-he.js
Octocat-spinner-32 jquery.calendars-hr.js
Octocat-spinner-32 jquery.calendars-hu.js
Octocat-spinner-32 jquery.calendars-hy.js
Octocat-spinner-32 jquery.calendars-id.js
Octocat-spinner-32 jquery.calendars-is.js
Octocat-spinner-32 jquery.calendars-it.js
Octocat-spinner-32 jquery.calendars-ja.js
Octocat-spinner-32 jquery.calendars-ko.js
Octocat-spinner-32 jquery.calendars-lt.js
Octocat-spinner-32 jquery.calendars-lv.js
Octocat-spinner-32 jquery.calendars-me-ME.js
Octocat-spinner-32 jquery.calendars-me.js
Octocat-spinner-32 jquery.calendars-mk.js
Octocat-spinner-32 jquery.calendars-ml.js
Octocat-spinner-32 jquery.calendars-ms.js
Octocat-spinner-32 jquery.calendars-nl-BE.js
Octocat-spinner-32 jquery.calendars-nl.js
Octocat-spinner-32 jquery.calendars-no.js
Octocat-spinner-32 jquery.calendars-pl.js
Octocat-spinner-32 jquery.calendars-pt-BR.js
Octocat-spinner-32 jquery.calendars-rm.js
Octocat-spinner-32 jquery.calendars-ro.js
Octocat-spinner-32 jquery.calendars-ru.js
Octocat-spinner-32 jquery.calendars-sk.js
Octocat-spinner-32 jquery.calendars-sl.js
Octocat-spinner-32 jquery.calendars-sq.js
Octocat-spinner-32 jquery.calendars-sr-SR.js
Octocat-spinner-32 jquery.calendars-sr.js
Octocat-spinner-32 jquery.calendars-sv.js
Octocat-spinner-32 jquery.calendars-ta.js
Octocat-spinner-32 jquery.calendars-th.js
Octocat-spinner-32 jquery.calendars-tr.js
Octocat-spinner-32 jquery.calendars-uk.js
Octocat-spinner-32 jquery.calendars-ur.js
Octocat-spinner-32 jquery.calendars-vi.js
Octocat-spinner-32 jquery.calendars-zh-CN.js
Octocat-spinner-32 jquery.calendars-zh-HK.js
Octocat-spinner-32 jquery.calendars-zh-TW.js
Octocat-spinner-32 jquery.calendars.all.js
Octocat-spinner-32 jquery.calendars.all.min.js
Octocat-spinner-32 jquery.calendars.all.pack.js
Octocat-spinner-32 jquery.calendars.coptic.js
Octocat-spinner-32 jquery.calendars.coptic.min.js
Octocat-spinner-32 jquery.calendars.coptic.pack.js
Octocat-spinner-32 jquery.calendars.ethiopian-am.js
Octocat-spinner-32 jquery.calendars.ethiopian.js
Octocat-spinner-32 jquery.calendars.ethiopian.min.js
Octocat-spinner-32 jquery.calendars.ethiopian.pack.js
Octocat-spinner-32 jquery.calendars.hebrew-he.js
Octocat-spinner-32 jquery.calendars.hebrew.js
Octocat-spinner-32 jquery.calendars.hebrew.min.js
Octocat-spinner-32 jquery.calendars.hebrew.pack.js
Octocat-spinner-32 jquery.calendars.islamic-ar.js
Octocat-spinner-32 jquery.calendars.islamic-fa.js
Octocat-spinner-32 jquery.calendars.islamic.js
Octocat-spinner-32 jquery.calendars.islamic.min.js
Octocat-spinner-32 jquery.calendars.islamic.pack.js
Octocat-spinner-32 jquery.calendars.js
Octocat-spinner-32 jquery.calendars.julian.js
Octocat-spinner-32 jquery.calendars.julian.min.js
Octocat-spinner-32 jquery.calendars.julian.pack.js
Octocat-spinner-32 jquery.calendars.lang.js
Octocat-spinner-32 jquery.calendars.lang.min.js
Octocat-spinner-32 jquery.calendars.lang.pack.js
Octocat-spinner-32 jquery.calendars.mayan.js
Octocat-spinner-32 jquery.calendars.mayan.min.js
Octocat-spinner-32 jquery.calendars.mayan.pack.js
Octocat-spinner-32 jquery.calendars.min.js
Octocat-spinner-32 jquery.calendars.pack.js
Octocat-spinner-32 jquery.calendars.persian-fa.js
Octocat-spinner-32 jquery.calendars.persian.js
Octocat-spinner-32 jquery.calendars.persian.min.js
Octocat-spinner-32 jquery.calendars.persian.pack.js
Octocat-spinner-32 jquery.calendars.picker-af.js
Octocat-spinner-32 jquery.calendars.picker-ar-DZ.js
Octocat-spinner-32 jquery.calendars.picker-ar.js
Octocat-spinner-32 jquery.calendars.picker-az.js
Octocat-spinner-32 jquery.calendars.picker-bg.js
Octocat-spinner-32 jquery.calendars.picker-bs.js
Octocat-spinner-32 jquery.calendars.picker-ca.js
Octocat-spinner-32 jquery.calendars.picker-cs.js
Octocat-spinner-32 jquery.calendars.picker-da.js
Octocat-spinner-32 jquery.calendars.picker-de-CH.js
Octocat-spinner-32 jquery.calendars.picker-de.js
Octocat-spinner-32 jquery.calendars.picker-el.js
Octocat-spinner-32 jquery.calendars.picker-en-AU.js
Octocat-spinner-32 jquery.calendars.picker-en-GB.js
Octocat-spinner-32 jquery.calendars.picker-en-NZ.js
Octocat-spinner-32 jquery.calendars.picker-eo.js
Octocat-spinner-32 jquery.calendars.picker-es-AR.js
Octocat-spinner-32 jquery.calendars.picker-es-PE.js
Octocat-spinner-32 jquery.calendars.picker-es.js
Octocat-spinner-32 jquery.calendars.picker-et.js
Octocat-spinner-32 jquery.calendars.picker-eu.js
Octocat-spinner-32 jquery.calendars.picker-fa.js
Octocat-spinner-32 jquery.calendars.picker-fi.js
Octocat-spinner-32 jquery.calendars.picker-fo.js
Octocat-spinner-32 jquery.calendars.picker-fr-CH.js
Octocat-spinner-32 jquery.calendars.picker-fr.js
Octocat-spinner-32 jquery.calendars.picker-gl.js
Octocat-spinner-32 jquery.calendars.picker-gu.js
Octocat-spinner-32 jquery.calendars.picker-he.js
Octocat-spinner-32 jquery.calendars.picker-hr.js
Octocat-spinner-32 jquery.calendars.picker-hu.js
Octocat-spinner-32 jquery.calendars.picker-hy.js
Octocat-spinner-32 jquery.calendars.picker-id.js
Octocat-spinner-32 jquery.calendars.picker-is.js
Octocat-spinner-32 jquery.calendars.picker-it.js
Octocat-spinner-32 jquery.calendars.picker-ja.js
Octocat-spinner-32 jquery.calendars.picker-ko.js
Octocat-spinner-32 jquery.calendars.picker-lt.js
Octocat-spinner-32 jquery.calendars.picker-lv.js
Octocat-spinner-32 jquery.calendars.picker-me-ME.js
Octocat-spinner-32 jquery.calendars.picker-me.js
Octocat-spinner-32 jquery.calendars.picker-mk.js
Octocat-spinner-32 jquery.calendars.picker-ml.js
Octocat-spinner-32 jquery.calendars.picker-ms.js
Octocat-spinner-32 jquery.calendars.picker-nl-BE.js
Octocat-spinner-32 jquery.calendars.picker-nl.js
Octocat-spinner-32 jquery.calendars.picker-no.js
Octocat-spinner-32 jquery.calendars.picker-pl.js
Octocat-spinner-32 jquery.calendars.picker-pt-BR.js
Octocat-spinner-32 jquery.calendars.picker-rm.js
Octocat-spinner-32 jquery.calendars.picker-ro.js
Octocat-spinner-32 jquery.calendars.picker-ru.js
Octocat-spinner-32 jquery.calendars.picker-sk.js
Octocat-spinner-32 jquery.calendars.picker-sl.js
Octocat-spinner-32 jquery.calendars.picker-sq.js
Octocat-spinner-32 jquery.calendars.picker-sr-SR.js
Octocat-spinner-32 jquery.calendars.picker-sr.js
Octocat-spinner-32 jquery.calendars.picker-sv.js
Octocat-spinner-32 jquery.calendars.picker-ta.js
Octocat-spinner-32 jquery.calendars.picker-th.js
Octocat-spinner-32 jquery.calendars.picker-tr.js
Octocat-spinner-32 jquery.calendars.picker-uk.js
Octocat-spinner-32 jquery.calendars.picker-ur.js
Octocat-spinner-32 jquery.calendars.picker-vi.js
Octocat-spinner-32 jquery.calendars.picker-zh-CN.js
Octocat-spinner-32 jquery.calendars.picker-zh-HK.js
Octocat-spinner-32 jquery.calendars.picker-zh-TW.js
Octocat-spinner-32 jquery.calendars.picker.css
Octocat-spinner-32 jquery.calendars.picker.ext.js
Octocat-spinner-32 jquery.calendars.picker.ext.min.js
Octocat-spinner-32 jquery.calendars.picker.ext.pack.js
Octocat-spinner-32 jquery.calendars.picker.js
Octocat-spinner-32 jquery.calendars.picker.lang.js
Octocat-spinner-32 jquery.calendars.picker.lang.min.js
Octocat-spinner-32 jquery.calendars.picker.lang.pack.js
Octocat-spinner-32 jquery.calendars.picker.min.js
Octocat-spinner-32 jquery.calendars.picker.pack.js
Octocat-spinner-32 jquery.calendars.plus.js
Octocat-spinner-32 jquery.calendars.plus.min.js
Octocat-spinner-32 jquery.calendars.plus.pack.js
Octocat-spinner-32 jquery.calendars.taiwan-zh-TW.js
Octocat-spinner-32 jquery.calendars.taiwan.js
Octocat-spinner-32 jquery.calendars.taiwan.min.js
Octocat-spinner-32 jquery.calendars.taiwan.pack.js
Octocat-spinner-32 jquery.calendars.thai-th.js
Octocat-spinner-32 jquery.calendars.thai.js
Octocat-spinner-32 jquery.calendars.thai.min.js
Octocat-spinner-32 jquery.calendars.thai.pack.js
Octocat-spinner-32 jquery.calendars.validation.js
Octocat-spinner-32 jquery.calendars.validation.min.js
Octocat-spinner-32 jquery.calendars.validation.pack.js
Octocat-spinner-32 redmond.calendars.picker.css
Octocat-spinner-32 smoothness.calendars.picker.css
Octocat-spinner-32 ui-black-tie.calendars.picker.css
Octocat-spinner-32 ui-blitzer.calendars.picker.css
Octocat-spinner-32 ui-cupertino.calendars.picker.css
Octocat-spinner-32 ui-dark-hive.calendars.picker.css
Octocat-spinner-32 ui-dot-luv.calendars.picker.css
Octocat-spinner-32 ui-eggplant.calendars.picker.css
Octocat-spinner-32 ui-excite-bike.calendars.picker.css
Octocat-spinner-32 ui-flick.calendars.picker.css
Octocat-spinner-32 ui-hot-sneaks.calendars.picker.css
Octocat-spinner-32 ui-humanity.calendars.picker.css
Octocat-spinner-32 ui-le-frog.calendars.picker.css
Octocat-spinner-32 ui-mint-choc.calendars.picker.css
Octocat-spinner-32 ui-overcast.calendars.picker.css
Octocat-spinner-32 ui-pepper-grinder.calendars.picker.css
Octocat-spinner-32 ui-redmond.calendars.picker.css
Octocat-spinner-32 ui-smoothness.calendars.picker.css
Octocat-spinner-32 ui-south-street.calendars.picker.css
Octocat-spinner-32 ui-start.calendars.picker.css
Octocat-spinner-32 ui-sunny.calendars.picker.css
Octocat-spinner-32 ui-swanky-purse.calendars.picker.css
Octocat-spinner-32 ui-trontastic.calendars.picker.css
Octocat-spinner-32 ui-ui-darkness.calendars.picker.css
Octocat-spinner-32 ui-ui-lightness.calendars.picker.css
Octocat-spinner-32 ui-vader.calendars.picker.css
Octocat-spinner-32 ui.calendars.picker.css
README.md

jQuery Localized Datepicker

For more info, see my blog post here: http://pyjamacoder.com/2011/12/12/jquery-datepicker-fully-localized

Modification to jQuery Calendars datepicker to: 1. convert numbers to localized numbers 2. populate a secondary field with the Gregorian value 3. minor change to 'disable' keyboard input for the text field

1) Converting localized numbers

Using /js/jquery.calendars/jquery.calendars.picker.js, a translateNumberFunction option can be passed in the localization file as follows:

// jquery.calendars.picker-fa.js
(function($) {
  $.calendars.picker.regional['fa'] = {
  /* other options */
  ...
  isRTL: true,
  translateNumberFunction: function(num){
    var string_value = num.toString();
    var mapping = { 
      0: '۰',
      1: '۱',
      2: '۲',
      3: '۳',
      4: '۴',
      5: '۵',
      6: '۶',
      7: '۷',
      8: '۸',
      9: '۹',
    };  

    for (x in mapping) {
      string_value = string_value.replace(new RegExp(x, 'g'), mapping[x]);
    }   

    return string_value;
  }
};

If no function is provided, no conversion will be done.

2) Populating a secondary field

If the calendarspicker input has an attribute data-gregorian-field, the selector provided in that attribute will get the Gregorian date value inserted.

<!-- the form element that brings up the date picker and shows the localized date -->
<input class="calendarspicker" type="input" data-gregorian-field="due_date" />
<!-- the actual value that gets passed along the form post to the backend -->
<input name="due_date" type="hidden" />

This is so a 'normal' date can be easily processed in the backend from a form submission, instead of having to jump through hoops to convert between calendars and languages.

3) Disabling keyboard input

Another optional parameter, to disable keyboard input for the input field, is provided.

$(function(){
  $('.calendarspicker').calendarsPicker({
    calendar: $.calendars.instance('persian', 'fa'),
    disableInput: true
  });
});

Original code from:

http://keith-wood.name/calendars.html

The initial commit is v 1.1.4 of the jQuery Calendars package.

Something went wrong with that request. Please try again.