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.
Project
ryanlowe-client_date
Uses client-side Javascript to format a datetime instead of the Ruby on Rails server
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
Development
Dependencies
Project Readme