Skip to content
This repository has been archived by the owner on Mar 24, 2021. It is now read-only.

Commit

Permalink
Merge pull request #979 from alphagov/formatting-defaults
Browse files Browse the repository at this point in the history
Update the defaults documentation
  • Loading branch information
carolinegreen committed May 12, 2015
2 parents 334b3d4 + a334ac3 commit c10d925
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion docs/format_options.md
Expand Up @@ -65,6 +65,15 @@ Accepts the options (unit: ['ms', 's', 'm'], pad: [true, false])
{ type: 'duration', unit: 'm' }
```

The default options for duration are:

```
{
unit: 'ms',
pad: true
}
```

###Currency

Accepts the options (symbol: defaults to '£', pence, dps). The magnitude option formats the value to the nearest significant scale. For example:
Expand All @@ -77,14 +86,32 @@ Accepts the options (symbol: defaults to '£', pence, dps). The magnitude option
{ sigfigs: 3, magnitude: true, type: 'currency' }
```

The default options for currency are:

```
{
symbol: '£',
pence: (true for anything less than 10 or false for anything greater than 10)
}
```

###Percent

Accepts the options (dps, normalisation, showSigns)
Accepts the options (dps [decimal places], normalisation, showSigns)

```
{ type: 'percent' }
```

The default options for percent are:

```
{
dps: 1,
normalisation: 1.0
}
```

###Integer

Calls number after it does a Math.round on the value.
Expand All @@ -106,6 +133,15 @@ Accepts the options (commans: [true, false], sigfigs, fixed, dps). The magnitude
{ sigfigs: 3, magnitude: true, type: 'number' }
```

The default options for number are:

```
{
commas: true,
sigfigs: 3
}
```

###Date

Accepts the options (format: 'D MMMM YYYY')
Expand All @@ -114,6 +150,14 @@ Accepts the options (format: 'D MMMM YYYY')
{ type: 'date' }
```

The default options for date are:

```
{
format: 'D MMMM YYYY'
}
```

###Time

Accepts the options (format: 'h:mma')
Expand All @@ -122,3 +166,11 @@ Accepts the options (format: 'h:mma')
{ type: 'time' }
```

The default options for time are:

```
{
format: 'h:mma'
}
```

0 comments on commit c10d925

Please sign in to comment.