public
Description: Rails plugin for dead-simple timezone support
Homepage: http://errtheblog.com/posts/49-a-zoned-defense
Clone URL: git://github.com/pjhyett/zoned.git
siannopollo (author)
Fri Mar 20 08:00:29 -0700 2009
pjhyett (committer)
Fri Mar 20 18:31:54 -0700 2009
zoned /
name age message
file LICENSE Wed Apr 30 23:13:10 -0700 2008 zoned import [pjhyett]
file README Wed Apr 30 23:13:10 -0700 2008 zoned import [pjhyett]
file init.rb Wed Apr 30 23:13:10 -0700 2008 zoned import [pjhyett]
file install.rb Wed Apr 30 23:13:10 -0700 2008 zoned import [pjhyett]
directory lib/ Fri Mar 20 18:31:54 -0700 2009 Disregarding server offsets and using the time ... [siannopollo]
directory spec/ Fri Mar 20 18:31:54 -0700 2009 Better specs for clarification Signed-off-by: ... [siannopollo]
README
Zoned
---

This plugin is the simplest way to add local times to your app.

Usage:

1) Call the javascript function Timezone.set() to set a timezone cookie

    eg: Hook it into the authentication system
    
      Logging in:
      <% form_for @login, { :html => { :onsubmit => "Timezone.set()" } %>
    
      Logging out:
      cookies.delete(:timezone)
      
    eg: Initialize it automatically
    
      window.onload = Timezone.set

2) Use it: <%= z(@post.created_at).strtime("%D") %>

If cookies[:timezone] is set it will convert the time to the user's 
local time, otherwise it will do nothing.

You don't need to have AR save your time in UTC, the plugin will determine 
your server's offset and adjust accordingly.