Sha256: 62c0f19aa711ef64e072d1a265a929504b7de9f13eb816a6c686129dbde79dd8
Contents?: true
Size: 589 Bytes
Versions: 37
Compression:
Stored size: 589 Bytes
Contents
module Rack class TimeZone Javascript = <<-EOJ function setTimezoneCookie() { var offset = (new Date()).getTimezoneOffset() var date = new Date(); date.setTime(date.getTime()+3600000); document.cookie = "utc_offset="+offset+"; expires="+date.toGMTString();+"; path=/"; } EOJ def initialize(app) @app = app end def call(env) request = Rack::Request.new(env) if utc_offset = request.cookies["utc_offset"] env["rack.timezone.utc_offset"] = -(utc_offset.to_i * 60) end @app.call(env) end end end
Version data entries
37 entries across 37 versions & 9 rubygems