All Downloads are FREE. Search and download functionalities are using the official Maven repository.

statics.widgets.clock.clock.coffee Maven / Gradle / Ivy

There is a newer version: 0.0.16
Show newest version
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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy