Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
courtland committed May 16, 2012
2 parents 118972c + 3834835 commit 2019b30
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
- messages go across all table
- display readonly associations in forms, it was ready to display them but it was skipping them
- Some fixes for inplace editors (cloning form overrides, ajax and radiobuttons). Add handlers for empty columns
- add wrap_tag to list so cells content can be wrapped in a tag for better styling
- fix date picker parsing for datetime fields when jquery is used
- add as:element_updated js event when replace or replace_html is called

= 3.2.7
- restore missing update.persistent feature
Expand Down
14 changes: 10 additions & 4 deletions lib/active_scaffold/finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,17 @@ def condition_value_for_datetime(value, conversion = :to_time)
Date.strptime(value, I18n.t('date.formats.default')) rescue nil
else
parts = Date._parse(value)
time_parts = [[:hour, '%H'], [:min, '%M'], [:sec, '%S']].collect {|part, format_part| format_part if parts[part].present?}.compact
format = "#{I18n.t('date.formats.default')} #{time_parts.join(':')} #{'%z' if parts[:offset].present?}"
format = I18n.translate 'time.formats.picker', :default => '' if ActiveScaffold.js_framework == :jquery
if format.blank?
time_parts = [[:hour, '%H'], [:min, '%M'], [:sec, '%S']].collect {|part, format_part| format_part if parts[part].present?}.compact
format = "#{I18n.t('date.formats.default')} #{time_parts.join(':')} #{'%z' if parts[:offset].present?}"
else
format += ' %z' if parts[:offset].present? && format !~ /%z/i
end
time = DateTime.strptime(value, format)
time = Time.zone.local_to_utc(time) unless parts[:offset]
time.in_time_zone.send(conversion) rescue nil
time = Time.zone.local_to_utc(time).in_time_zone unless parts[:offset]
time = time.send(conversion) unless conversion == :to_time
time
end unless value.nil? || value.blank?
end

Expand Down

0 comments on commit 2019b30

Please sign in to comment.