Skip to content

Commit

Permalink
Better documentation on Date.js and Sugar.js
Browse files Browse the repository at this point in the history
  • Loading branch information
adamalbrecht committed Nov 24, 2013
1 parent dd17e87 commit 8e4a06e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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

Expand Down

0 comments on commit 8e4a06e

Please sign in to comment.