-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for MM-DD-YYYY? #1
Comments
No. American dates are always separated with slashes in my experience (Wikipedia seems to agree). There may be users that want MDY for slash separated dates and DMY for dash separated dates. However, if you want to support dash-separated dates as well as slash separated dates, here's a quick hack that should work:
|
Thanks |
Thanks Jeremy for the recommendation. I definitely wanted dash support as well. I've added the recommend patch for now. FWIW: The chronic gem parses both formats american style. |
Wikipedia has this to say about American date formats. Emphasis added:
There is nothing particularly American about slashes -- a gem that aims to be usable for most applications should support arbitrary delimiters. |
I think you are quoting Wikipedia out of context, see http://en.wikipedia.org/wiki/Date_and_time_notation_in_the_United_States, which only mentions slash separated middle endian dates. Middle-endian date format may used with other delimiters in other countries, but in the USA, it is very rare to see dates in America use something other than a slash for middle endian dates, in my experience (I can't recall a single example). Looking at http://en.wikipedia.org/wiki/Date_format_by_country, I don't see a single middle endian date example using something other than a slash delimiter. I've already posted a trivial monkey patch to get the behavior you want. Please use that if you want to handle non-slash delimiters. |
Also, FWIW, american_date reflects ruby 1.8 behavior:
Considering the first sentence of the README, "ruby-american_date exists to make ruby versions greater than 1.8 parse american-style month/day/year dates correctly, just like ruby 1.8.", I think the current behavior makes sense and don't plan to change it. |
Totally understand the 1.8 support -- that makes sense, and we'll end up having to just use our forked version of the gem. But neither Wikipedia nor your memory should determine which date delimiters are worth supporting -- the final authority should be application users. And a cursory search will turn up plenty of examples of users using dashes in American dates. Here's one from the U.S. government: http://www.nasa.gov/directorates/heo/reports/iss_reports/2012/05032012.html. |
I noticed the library only recognizes
MM/DD/YYYY
and notMM-DD-YYYY
. Any plans to support the latter?The text was updated successfully, but these errors were encountered: