anjlab / anjlab-widgets

UI Widgets on top of anjlab-bootstrap-rails
MIT License
54 stars 15 forks source link

date picker only works for DateTime objects, not Dates #1

Closed bedaro closed 11 years ago

bedaro commented 11 years ago

Nice date widget! But I have one problem:

I noticed there's some low-level code in the gem that tries to call time methods on the value without checking to see if the value is a DateTime. If it's a Date, you get this:

private method `hour' called for Mon, 04 Feb 2013:Date

anjlab-widgets (1.0.2) lib/anjlab-widgets/simple_form.rb:48:in input' simple_form (2.1.0) lib/simple_form/wrappers/many.rb:29:inblock in render' simple_form (2.1.0) lib/simple_form/wrappers/many.rb:27:in each' simple_form (2.1.0) lib/simple_form/wrappers/many.rb:27:inrender' simple_form (2.1.0) lib/simple_form/wrappers/many.rb:29:in `block in render' etc...

This happens even if I add as: :date to the input.

I can work around this in a few areas but now I'm coming across problems with some of my model objects that use date types extensively, not datetimes.