Baremetrics / calendar

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

Cannot pick a date in august if language is italian #61

Open tiljanssen opened 7 years ago

tiljanssen commented 7 years ago

The current check for "ago" and "ahead" in the date input will match "Agosto" which is the italian translation for August. Since the month is not the 3rd word in the date, this means that dates picked in august will revert back to the current date.

I suggest you use regexp with word boundaries instead of simply searching the date string.

Note also that you try to use a "lookbehind" regexp to strip the "st|nd|rd|th" from the day. However lookbehind is not supported in javascript, and this results in any match of "st" including the "st" in Agosto. A better regexp may be /(?:\d)((?:st|nd|rd|th)?,?/ (it also gets rid of a possible comma after the day when someone enters august 2nd, 2016) For even more accuracy you might also add a word boundary somewhere.

basvis commented 7 years ago

@tyvdh +1

tiljanssen commented 7 years ago

Fixed in pull request #62, can be closed.