Skip to content

Instantly share code, notes, and snippets.

@pgib
Created July 19, 2012 19:28
Show Gist options
  • Select an option

  • Save pgib/3146191 to your computer and use it in GitHub Desktop.

Select an option

Save pgib/3146191 to your computer and use it in GitHub Desktop.
e = Essentials::Event.create( {:start_date => "Thu Jul 19 00:00:00 UTC 2012", :group_name => "Boston Sites Program", :group => Essentials::Program.first.id.to_s, :location => "borkbork", :end_time => nil, :created_at => "Thu Jul 19 18:28:36 UTC 2012", :body => " asdfasdf ", :title => "bork", :updated_at => "Thu Jul 19 18:39:20 UTC 2012", :user_type => "grantee", :highlighted => false, :time_zone => "Mountain Time (US & Canada)", :program => nil, :summary => "asdfasdf", :start_time => "Thu Jul 19 19:00:00 UTC 2012", :active => false} )
start_with_zone = ActiveSupport::TimeWithZone.new(e.start_time.getutc, ActiveSupport::TimeZone.new(e.time_zone))
if e.start_time && e.end_time
end_with_zone = ActiveSupport::TimeWithZone.new(end_time.getutc, ActiveSupport::TimeZone.new(time_zone))
"#{start_with_zone.strftime('%H:%M %Z')} - #{end_with_zone.strftime('%H:%M %Z')}"
else
"#{start_with_zone.strftime('%H:%M %Z')}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment