lib/onebox/engine/twitter_status_onebox.rb in onebox-1.4.2 vs lib/onebox/engine/twitter_status_onebox.rb in onebox-1.4.3
- old
+ new
@@ -39,12 +39,16 @@
end
end
def timestamp
if raw.html?
- raw.css(".metadata span").inner_text
+ raw.css(".metadata span")[0].inner_text
else
- access(:created_at)
+ created_at = access(:created_at)
+ date = DateTime.strptime(created_at, "%a %b %d %H:%M:%S %z %Y")
+ user_offset = access(:user, :utc_offset).to_i
+ offset = (user_offset >= 0 ? "+" : "-") + Time.at(user_offset.abs).gmtime.strftime("%H%M")
+ date.new_offset(offset).strftime("%l:%M %p - %e %b %Y")
end
end
def title
if raw.html?