MakingSense / moment-datepicker

[ABANDONED REPOSITORY] The best bootstrap datepicker!
Apache License 2.0
92 stars 64 forks source link

Allows use of an array of date formats #54

Closed eddielee6 closed 10 years ago

eddielee6 commented 10 years ago

Moment.js allows use of an array of date formats when parsing dates.

This means that you can do... moment('05/05/1945', ['dd/mm/yyyy', 'dd-mm-yyy']) and moment('05-05-1945', ['dd/mm/yyyy', 'dd-mm-yyy']) and both will work. Moment will keep trying the formats in the array until it finds the correct one to parse it with.

I have updated the date picker to accept an array for the 'format' parameter. It then uses the first format in the array as the display format.

eddielee6 commented 10 years ago

I have updated the PR with your suggestion for enabling strict parsing only for dates. However moment have acknowledged the issue with the date parser and will hopefully resolve it in a future version.

https://github.com/moment/moment/issues/1746

eddielee6 commented 10 years ago

Looking at other pull requests this removes the need for this https://github.com/MakingSense/moment-datepicker/pull/46