node package manager
Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »


Crutch is a (terrible) way to use Chronic in NodeJS applications.

In a nutshell

var parse = require('crutch').parse
parse( 'next tuesday at 2pm', function( err, date, str ){
  if (err) throw err;
  console.log( 'Javascript date object: ', date );
  //=> Javascript date object:  Tue, 29 Nov 2011 19:00:00 GMT 
  console.log( 'Chronic actually said: ', str );
  //=> Chronic actually said:  2011-11-29 14:00:00 -0500 

Getting Crutch

Install via npm, thusly:

npm install crutch

** Ruby, Chronic, and JSON must be installed locally.

Why would you do this?

Honestly, because missing Chronic is keeping me from building shit in Node.

What about (insert JS date-parsing library)?

I didn't find one I considered "robust enough" when I looked.

"Crutch" is exactly that: something to lean on until it's no longer useful. I hope that's soon.

Can I use it in production?

I might, but you probably wouldn't want to.

How does it work?

It spawns a ruby process, then uses JSON-RPC's ugly cousin to coax magic of Chronic#parse.

Who are you?

Send your hate-mail to: Kieran Huggins, partner at Refactory in Toronto, Canada.