Skip to content

Commit

Permalink
abbreviated last updated time displayed but full datetime included in…
Browse files Browse the repository at this point in the history
… title of span
  • Loading branch information
stevenwilkin committed May 1, 2009
1 parent f770074 commit b3f8f99
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion trends.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
require 'sinatra'
require 'haml'
require 'json'
require 'date'

get '/' do
file = File.expand_path(File.dirname(__FILE__)) + '/var/trends.json'
json = JSON.parse(File.read(file))
@trends = json['trends']
@updated = json['as_of']
@updated_full = json['as_of']
@updated = DateTime.parse(@updated_full).strftime('%H:%S')
haml :index
end

Expand Down
3 changes: 2 additions & 1 deletion views/index.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
%li
·
%a{:href => t['url'], :title => "search twitter for '#{t['name']}'"}= t['name']
== last updated #{@updated}
last updated
%span{:title => @updated_full}= @updated

#images
%ol
Expand Down

0 comments on commit b3f8f99

Please sign in to comment.