lucianocosta / jquery.mtz.monthpicker

Monthpicker, the missing JQuery widget.
http://lucianocosta.com.br/jquery.mtz.monthpicker
96 stars 57 forks source link

Standard DateFormat/Localization Support #39

Open AlexandreArpin opened 11 years ago

AlexandreArpin commented 11 years ago

Currently, the DateFormat is pretty much baked inside the plugin, with no standard compliance with Localisation and JQuery UI Datepicker.

The way I see it, this plugin should be compatible with JQuery UI Datepicker options and Localisation support (through the i18n plugins)

Which would mean:

(And probably some other things, I am not an expert with Localisation...)

I do not think MonthPicker should depends on the JQuery UI Datepicker plugin, but it'd be nice if their options would be compatible.

Ideally, I would be able to do something like this:

 var options = {
       pattern: $(".datepicker").datepicker("option", "dateFormat");,
       monthNames: $(".datepicker").datepicker("option", "monthNames");
       monthNamesShort: $(".datepicker").datepicker("option", "monthNamesShort");
 };

I realize this might be outside the scope of this plugin, I would appreciate if you could share your vision of this plugin, and if this is the sort of things you'd like to see integrated to it.

lucianocosta commented 11 years ago

Yeap! For now, you could do it this way, in initialization:

$('#your_widget').monthpicker({monthNames: $.datepicker._defaults.monthNamesShort});

About pattern, some regex over $.datepicker._defaults.dateFormat would do the trick too.

At a first look, I can't see any constraint in adding this behaviour if $.datepicker is defined.