Baremetrics / calendar

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

Problem selecting presets in non-English locales #80

Open laynegt opened 7 years ago

laynegt commented 7 years ago

Ran into a strange issue today when testing i18n changes in French. Might be related to #73.

The issue is that calendarCheckDate is erroneously creating a valid moment in some non-English locales (at least when using the default date format of MMMM D, YYYY). In my case, that meant all my preset dates were turning into Jan 20th. Seems like it could be a bug in moment (didn't see any after a cursory check).

Here are some examples (using moment) of the behavior I'm seeing.

Can the preset click handler just directly create moments instead of calling calendarCheckDate? Seems like the presets will always produce ISO 8601 date strings. This seemed to have fixed it in my fork.

Thanks.

kalepail commented 7 years ago

Thanks for bringing up the issue. I'll have to take a better look once I get some time but it looks like ensuring those dates are moment dates could potentially solve the problem.

melnikoved commented 6 years ago

Hello! Do you have any progress? I found that the fix in @laynegt fork works right.

ETIBER commented 5 years ago

I've also this situation