Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bjornblomqvist-input_chronic

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bjornblomqvist-input_chronic

  • 1.0.5
  • Rubygems
  • Socket score

Version published
Maintainers
2
Created
Source

= input_chronic

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 "input_chronic" in your middleware stack. In Rails, this is done in environment.rb

config.gem 'bjornblomqvist-input_chronic', :lib => 'input_chronic', :source => 'http://gems.github.com' config.middleware.use "input_chronic"

This will catch requests to /gems.github.com/bjornblomqvist/input_chronic. 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.

Don't forget to add the javascript found at

/javascript/input_chronic.js

This is also implemented by catching the request before it reaches rails.

To use this on a text input add the class chronic_date or chronic_datetime

<input type="text" class="chronic_datetime" />

== Copyright

Copyright (c) 2009 Erik Hansson, Bjorn Blomqvist. See LICENSE for details.

FAQs

Package last updated on 11 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc