Reputation: 10111
I stated a ROR project gem bootstrap3-datetimepicker-rails and it looks great but when I pick a date I get am error that the date can't be blank I try to submit the date in dd/mm/yyyy format and it works then but the USA English wants the date in mm/dd/yyyy I am thinking that there has to be a config in rails it self where i can update this so it takes the date in the right format.
Upvotes: -2
Views: 135
Reputation: 10673
You realize that the date format is set via JavaScript, right? Take a look at the documentation for that gem here.
This line, in particular, is what you're going to modify:
<input data-format="dd/MM/yyyy hh:mm:ss" type="text"></input>
Now what you have to do is to grab the user's language prefs from the browser, or, since we can safely assume that the user has registered for the web application that you're writing, grab his locale preferences. Your JavaScript can branch on either of those criteria to select the locale appropriate date format, and you should be in good shape.
Upvotes: 6