Skip to content

Instantly share code, notes, and snippets.

@ArturT
Forked from jackdesert/gist:7090731
Last active August 29, 2015 13:56
Show Gist options
  • Save ArturT/8804428 to your computer and use it in GitHub Desktop.
Save ArturT/8804428 to your computer and use it in GitHub Desktop.
don't change non DateTime
require 'rails_admin/config/fields/base'
module RailsAdmin
module Config
module Fields
module Types
class Datetime < RailsAdmin::Config::Fields::Base
def value
value_in_default_time_zone = bindings[:object].send(name)
return nil if value_in_default_time_zone.nil?
if value_in_default_time_zone.is_a?(DateTime)
pacific_time_zone = ActiveSupport::TimeZone.new('US/Pacific')
value_in_default_time_zone.in_time_zone(pacific_time_zone)
else
value_in_default_time_zone
end
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment