Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README.md #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 28 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,37 @@ and [NumberFormat](http://java.sun.com/javase/6/docs/api/java/text/NumberFormat.
## Usage

Formatting dates and numbers is as easy as the following:

$.format.date(new Date(), 'MMMM dd, yyyy KK:mm:ss:SSS a');
$.format.number(7456.2, '#,##0.00#');

```javascript
$.format.date(new Date(), 'MMMM dd, yyyy KK:mm:ss:SSS a');
$.format.number(7456.2, '#,##0.00#');
```
Parsing is very similar to the formatting but works with strings as a first parameter:
```javascript
$.format.date('1.5.2009', 'dd.MM.yyyy');
$.format.number('1.231.231.212,3241');
```

$.format.date('1.5.2009', 'dd.MM.yyyy');
$.format.number('1.231.231.212,3241');

The second format parameter is always optional and by default the plugin uses the formats
of the en_US locale. The locale can be globally configured using the following:

$.format.locale({
date: {
format: 'dddd, MMMM dd, yyyy h:mm:ss tt',
monthsFull: ['January','February','March','April','May','June','July','August','September','October','November','December'],
monthsShort: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
daysFull: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
daysShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
timeFormat: 'h:mm tt',
shortDateFormat: 'M/d/yyyy',
longDateFormat: 'dddd, MMMM dd, yyyy'
},
number: {
format: '#,##0.0#',
groupingSeparator: ',',
decimalSeparator: '.'
}
});
```javascript
$.format.locale({
date: {
format: 'dddd, MMMM dd, yyyy h:mm:ss tt',
monthsFull: ['January','February','March','April','May','June','July','August','September','October','November','December'],
monthsShort: ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],
daysFull: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
daysShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
timeFormat: 'h:mm tt',
shortDateFormat: 'M/d/yyyy',
longDateFormat: 'dddd, MMMM dd, yyyy'
},
number: {
format: '#,##0.0#',
groupingSeparator: ',',
decimalSeparator: '.'
}
});
```

## Changes

Expand All @@ -60,4 +62,4 @@ of the en_US locale. The locale can be globally configured using the following:

### 12/23/2009 - jQuery Format 1.0

Initial release
Initial release