zpaulovics / datetimepicker-rails

A date and time picker for Twitter Bootstrap in Rails using Simple Form
MIT License
174 stars 80 forks source link

Problem with default date format? #75

Closed RailsCod3rFuture closed 8 years ago

RailsCod3rFuture commented 8 years ago

When I type 05/25/1987 into the text box. I receive "Object must be a Date, DateTime or Time object." error upon returning to the form. I had to literally delete the attribute just to edit the form. How can I get the format to match my requirements?

validates_format_of :birthday, :with => /\d{2}\/\d{2}\/\d{4}/, :message => '^Date must be in the following format: mm/dd/yyyy'

RailsCod3rFuture commented 8 years ago

I fixed the error by converting the attribute's type into a date. I'm still having problems with the showing date format. It says %d/%y/%m. I need month/date/year. As, I have written above.

ayounis90 commented 8 years ago

@RailsCod3rFuture This might be a very silly question but have you tried %m/%d/%Y ?

RailsCod3rFuture commented 8 years ago

It worked. Thanks!