Skip to content

Commit

Permalink
it vorks for rails 3!
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianpike committed Nov 24, 2010
1 parent 81ce351 commit 3101f2b
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion init.rb
Expand Up @@ -2,7 +2,6 @@
require 'sane_datetimes'
ActiveRecord::Base.class_eval { include SaneDatetimes }


if defined? Formtastic then
require 'formtastic_hacks'
class Formtastic::SemanticFormBuilder
Expand Down
2 changes: 1 addition & 1 deletion lib/formtastic_hacks.rb
Expand Up @@ -45,7 +45,7 @@ def sane_datetime_input(method, options)
inputs_capture << template.select_tag("#{@object_name}[#{field_name}]", template.options_for_select(select_options,decoded_date), this_html_options.merge(:id => html_id))

when :date
inputs_capture << template.text_field_tag("#{@object_name}[#{field_name}]", datetime.to_date, this_html_options.merge(:id => html_id))
inputs_capture << template.text_field_tag("#{@object_name}[#{field_name}]", I18n.l(datetime.to_date), this_html_options.merge(:id => html_id))
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/sane_datetimes.rb
Expand Up @@ -2,7 +2,7 @@ module SaneDatetimes
def self.included(base)
define_method :instantiate_time_object_with_two_field_date_times do |name, values|
begin
if RUBY_VERSION >= '1.9'
if RUBY_VERSION >= '1.9'
values = Time.strptime(values.join(' '),"%m/%d/%Y %I:%M %p").to_time.to_a[0..5].reverse if values.first.is_a? String
else
values = Time.parse(values.join ' ').to_a[0..5].reverse if values.first.is_a? String
Expand Down

0 comments on commit 3101f2b

Please sign in to comment.