This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
.gitignore | ||
| |
.loadpath | ||
| |
.project | ||
| |
CHANGELOG | ||
| |
MIT-LICENSE | ||
| |
README | ||
| |
Rakefile | ||
| |
TODO | ||
| |
client_date.gemspec | ||
| |
init.rb | ||
| |
lib/ | ||
| |
public/ | ||
| |
test/ |
README
Hosted at GitHub since May 1, 2008 http://github.com/ryanlowe/client_date Was hosted at Google Code http://code.google.com/p/client-date/ = client_date The client_date Ruby on Rails plugin uses client-side Javascript to format a date/time in a view instead of the server. The client is given UTC time for formatting so the server doesn't have to store which time zone each user is in. Of course it's also very handy for users that haven't logged in or do not have a login. == Installation gem install ryanlowe-client_date --source http://gems.github.com/ == Setup First include the ClientDate mixin in your ApplicationHelper. module ApplicationHelper include ClientDate ... end Then copy the javascript code in javascripts/client_date.js to your project. You can do this two ways: 1. Copy client_date.js to your javascripts/ directory and add it to your Rails project using javascript_include_tag. 2. Copy the code in client_date.js to javascripts/application.js which is pulled in by javascript_include_tag :defaults. == Usage In a view you can use: format_date(date) # month, day format_datetime(date) # month, day, hour, minute format_datetime(date,true) # month, day, hour, minute, seconds The date parameter should be a normal Ruby date, like the "datetime" used in Rails migrations. Example: <p>Created at: <%= format_datetime(post.created_at) %></p> == Customization Change how client_date formats dates and times by changing the fd() and fdt() Javascript functions.








