Baremetrics / calendar

Date range picker for Baremetrics
MIT License
679 stars 78 forks source link

Display formats & i18n #26

Closed SleeplessByte closed 8 years ago

SleeplessByte commented 8 years ago

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

The date parser that accepts now, stringToDate etc. now also parses using the set display_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

The month/year values of the switchers are stored into data variables (because with the transform functions, you could irreversibly transform the string).

kalepail commented 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!!

SleeplessByte commented 8 years ago

I'll rebase it :)

SleeplessByte commented 8 years ago

I guess it was still working?

kalepail commented 8 years ago

Somewhat. I tweaked it a lot and took out the function actions.. but the idea as a whole was great!