fhsav / clock

The clock for Farmington High School.
http://fhsclock.com
Other
12 stars 2 forks source link

Better handling of time zones #206

Closed ethnt closed 12 years ago

ethnt commented 12 years ago

As of right now, this is app/helpers/helpers.rb.

Clock.helpers do
  def from_utc(time)
    time - 14400
  end

  def time(t, scale = 12)
    t = from_utc(t)

    if scale == 12
      t.strftime("%k:%M").to_s.strip
    else
      t.strftime("%I:%M")
    end
  end
end

We shouldn't subtract an absolute value to get the data from UTC to whatever time zone we need.