From 8e4a06ef1d129df19ea9ee8fde7b19fb8a1a582f Mon Sep 17 00:00:00 2001 From: Adam Albrecht Date: Sat, 23 Nov 2013 21:37:38 -0800 Subject: [PATCH] Better documentation on Date.js and Sugar.js --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ad836e0..c313bf9 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,9 @@ function(str) { ## Smarter Date/Time Parsing -By default, dates and times entered into the 2 input boxes are parsed using javascript's built-in `Date.parse()` function. This function does not support many formats and can be inconsistent across platforms. I recommend using either the [Sugar.js](http://sugarjs.com/) or [Date.js](http://www.datejs.com/) library instead. With Date.js, the parse method on the Date object is overwritten, so you don't need configure anything. If you'd like to use Sugar, you can configure it to work like so: +By default, dates and times entered into the 2 input boxes are parsed using javascript's built-in `Date.parse()` function. This function does not support many formats and can be inconsistent across platforms. I recommend using either the [Sugar.js](http://sugarjs.com/) or [Date.js](http://www.datejs.com/) library instead. Of the 2, I recommend definitely Sugar. + +If you'd like to use Sugar, you can configure it to work like so: ```javascript app.config(function(ngQuickDateDefaultsProvider) { @@ -96,7 +98,15 @@ app.config(function(ngQuickDateDefaultsProvider) { }) ``` -With either library, you'll be able to input more natural formats such as 'Today' or '1pm'. Of course, you can override this parse function with any code you'd like, so you're also free to swap in another library or write your own parser. +And with Date.js: + +```javascript +parseDateFunction: function(str) { + return Date.parse(str); +} +``` + +Of course, you can override this parse function with any code you'd like, so you're also free to swap in another library or write your own parser. ## Date Formatting