jQuery UI datepicker: Is there a way to display leading zeros in the dialog?

jquery, jquery-ui, jquery-ui-datepicker

Solution

Here is my hack solution. It works! :)

We can use combination of CSS and JavaScript. There is one `datepicker` event `beforeShowDay` which we can exploit in our approach.

CSS:

.ui-datepicker-calendar td.zero a:before {
    content: "0";
}​

JavaScript:

$("input").datepicker({
    beforeShowDay : function(date) {
        var day = date.getDate();
        return [true, (day < 10 ? "zero" : "")];
    }
});

DEMO: http://jsfiddle.net/vZ7wm/

Problem

I need do display leading zeros in the jQuery UI datepicker: e.g., `1 2 3 4 5 6 7 8 9 10` -> `01 02 03 04 05 06 07 08 09 10` Similar question to this one: http://forum.jquery.com/topic/displaying-leading-zero-for-day-numbers-of-datepicker Maybe someone does have a workaround?

Original source