Browse the Ruby on Rails Community.

You are here: Browse Railsplugins Will Timezone

Will Timezone

Will Timezone

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)

2) Use it: <%= wt(@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

NOTE: This description has been extracted from the Plugin README and so the formatting may need updating to make browser friendly

Users


See all details


Membership

+ Join this railsplugin

Record Maintainer

'None'