[jQuery] DatePicker plugin: dateFormat enhancement [u]

[jQuery] DatePicker plugin: dateFormat enhancement [u]

hi community and kevin luck,
first i must thank kevin you for his great datepicker. it's really fantastic
and fits perfect into my project (even the css :)). but unfortunately he
forget the "old world" in his predefiend dateFormats versions. here in
swiss, austria, and german is the "." the regular dateFormat separator. so
i've changed your plugin a bit and made the formatting/parsing of a date a
bit more generic.
in detail, i split up the format into the old well known dateFormat and a
new dateSeparator.
dateFormat can now be one of: 'dmy' (european), 'mdy' (americian) or 'ymd'
(unicode) (formerly 'dd/mm/yyyy' (european), 'mm/dd/yyyy' (americian) and
'yyyy-mm-dd' (unicode)) and dateSeparator can be anything you like, for
example '-', '/', '.', '\'', or even '' for no separator ...
so the new setDateFormat() function looks like:
        setDateFormat: function(format,separator)
        {
            // set's the format that selected dates are returned
in.
            // options are 'dmy' (european), 'mdy' (americian)
and 'ymd' (unicode)
            dateFormat = format.toLowerCase();
            dateSeparator = separator?separator:"/";
        },
usage examples:
$.datePicker.setDateFormat('dmy','.');//german
$.datePicker.setDateFormat('dmy','/');//equals to default "dd/mm/yyyy"
$.datePicker.setDateFormat('ymd','-');//unicode
$.datePicker.setDateFormat('mdy','/');//american
$.datePicker.setDateFormat('mdy'); //also american with default '/'
separator
i've changed the datePicker_source.js and created the attached patch file
(svn, eclipse) based on revision 630. the attached index.html is a test with
a german translation and format. code is testetd on ie6, ff1.5, ff2.0.
if you find this patch usefull, pls. commit it into the SVN.
btw, i have some feature requests:
1) i need the ability to select a date in the far future (life insurance
finalization date ~ +20 years, that should not be on weekend, so i need to
lookup into the calendar). i.e. year paging as well as month paging or
direkt year selectiong (select box)
2) the possibility to set the weeks startday for example to sunday
did you (kevin) plan something like that? if not, i will take this version
and start a branch...
regards stefan
**************************************
*** Stefan Flick ***
*** 2333 Leopoldsdorf b. Wien ***
*** Austria ***
*** Skype: callto://flick,stefan/ ***
**************************************
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/