Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Rack middleware for Chronic
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
generators
lib
.gitignore
README
Rakefile

README

# Livedate

A simple Rack middleware that parses a dates using Chronic, and 
returns the result in a standardized manner. The idea is to use 
this to verify the input in date input fields using AJAX, to 
provide immediate feedback to the user.


## Usage

Include Livedate in your middleware stack. In Rails, this
is done in environment.rb

  config.gem 'livedate'
  config.middleware.use "Livedate"

This will catch requests to /parsedate. Use GET requests and
provide a parameter 'date' or 'datetime'. The value will be 
parsed by Chronic and returned formatted as 2009-01-01 or
2009-01-01 12:45, depending on the parameter name.


## Scripts

There are two generators available to get simple javascripts 
that use livedate. Both will replace the contents on input
elements with classes .date or .datetime on change with the
result from the Chronic parse.

  script/generate livedate_jquery
  script/generate livedate_prototype
  
Will put the appropriate version of the script in your
public/javascripts directory. Feel free to change these
if you need a different behavior.
Something went wrong with that request. Please try again.