Skip to content

Commit c39be89

Browse files
Scott Gerringpushmatrix
Scott Gerring
authored andcommitted
Display 'last updated' using user's locale. Closes Shopify#10
1 parent 694f8d9 commit c39be89

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

javascripts/dashing.coffee

+4-2
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ class Dashing.Widget extends Batman.View
4444

4545
@accessor 'updatedAtMessage', ->
4646
if updatedAt = @get('updatedAt')
47-
timestamp = updatedAt.toString().match(/\d*:\d*/)[0]
48-
"Last updated at #{timestamp}"
47+
timestamp = new Date(updatedAt * 1000)
48+
hours = timestamp.getHours()
49+
minutes = ("0" + timestamp.getMinutes()).slice(-2)
50+
"Last updated at #{hours}:#{minutes}"
4951

5052
@::on 'ready', ->
5153
Dashing.Widget.fire 'ready'

lib/dashing.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def production?
8181

8282
def send_event(id, body)
8383
body["id"] = id
84-
body["updatedAt"] = Time.now
84+
body["updatedAt"] = Time.now.to_i
8585
event = format_event(body.to_json)
8686
settings.history[id] = event
8787
settings.connections.each { |out| out << event }

0 commit comments

Comments
 (0)