datify
datify your objects.
how
> npm install datify
Datify = ; should; should; should;
non-conservative
Datify, by default, will parse only simple ISO strings ('2011-09-13T17:09:30.909Z'
, '2011-09-13T17:09:30Z'
), it has a mode where everything that can be parsed to Date is parsed to date.
Just:
Datifyoptionsconservative = false
And then:
should;
why
Suppose you are building an API, and you receive a JSON. You want to parse & save that JSON to the DB - but your dates are strings (the JSON way). So what you do is store the datifyed version. You might:
collection;
Suppose you are using an API (from the browser, for example), that have dates in it, as strings (it is JSON, after all) - you just datify it.
apiResult = ;
test
> npm install> make test
test on your favorite browser
> npm install> make browserify-test
open browserTest.html in your favorite browser, for example:
> firefox ./browserTest.html