This repository has been archived on 2025-11-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
dashboard/widgets/clock/clock.coffee
2022-09-20 00:27:25 +01:00

18 lines
389 B
CoffeeScript

class Dashing.Clock extends Dashing.Widget
ready: ->
setInterval(@startTime, 500)
startTime: =>
today = new Date()
h = today.getHours()
m = today.getMinutes()
s = today.getSeconds()
m = @formatTime(m)
s = @formatTime(s)
@set('time', h + ":" + m + ":" + s)
@set('date', today.toDateString())
formatTime: (i) ->
if i < 10 then "0" + i else i