Closed SleeplessByte closed 8 years ago
@SleeplessByte Made a number of changes due to other issues and requests. If you could confirm this branch is still working I'll take a look and likely merge. Thanks for the PR!!
I'll rebase it :)
I guess it was still working?
Somewhat. I tweaked it a lot and took out the function actions.. but the idea as a whole was great!
Display formats and localization
Fixes #2 except for the presets. I will tackle that in a different branch, because the presets should be complete rewritten.
It now supports ANY display format for the date, a transform function for the day, month and year displays, a format for the month and year switchers and automagically uses moment's locale.
Locale
Set
moment.locale( ... )
to instantly localize the entire picker for a locale, except for the display date. Follow instructions on momentjs.com how to include a locale file.Display format options
display_format = moment_format
for display dates.D [x] MMMM [x] YY
.MMMM D, YYYY
LL
display_month_format = moment_format
for displayed month names (switcher).MMMM
andMM
MMMM
display_year_format = moment_format
for displayed year names (switcher).YYYY
andYY
YYYY
The date parser that accepts
now
,stringToDate
etc. now also parses using the setdisplay_format
.Transformation functions
Right before a day name, month name or year number is displayed in the switchers or the table header, it is ran through a tranformation function
transform_day = function(d){ return d; }
to transform the day display right before it's displayed.moment.weekDaysMin()
to match the value with the day.transform_month
for the month switchertransform_year
for the year switcherThe month/year values of the switchers are stored into data variables (because with the transform functions, you could irreversibly transform the string).