Skip to content

Commit

Permalink
v1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ndresx committed May 16, 2017
1 parent a3b84a5 commit c45bb60
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,21 +187,23 @@ This module also exports 2 simple helper functions which can be utilized to buil
import Countdown, { zeroPad, getTimeDifference } from 'react-countdown-now';
```

### `zeroPad(value, length = 2)`
### `zeroPad(value, [length = 2])`
The `zeroPad` function works similar to other well-known pad-functions and takes 2 arguments into account. A `value` which can be a `string` or `number`, as well as a `length` parameter which defaults to `2` as you are most likely only going to use this function if you actually want to pad one of your values.

### `getTimeDifference(date, now = Date.now, precision = 0, controlled = false)`
`getTimeDifference` calculates the time difference between a given end [`date`](#date) and the current date (`now`). It returns, similiar to the [`renderer`](#renderer) callback, a custom object which contains some time related data.
### `getTimeDifference(date, [{ now = Date.now, precision = 0, controlled = false }])`
`getTimeDifference` calculates the time difference between a given end [`date`](#date) and the current date (`now`). It returns, similiar to the [`renderer`](#renderer) callback, a custom object which contains some time related data:

```js
{ total, days, hours, minutes, seconds, milliseconds, completed }
```

This function accepts 4 arguments in total, only the first one is required.
This function accepts 2 arguments in total, only the first one is required.

**`date`**
Date or timestamp representation of the end date. See [`date`](#date) prop for more details.

The second argument could be an optional object consisting of the following 3 optional keys.

**`now = Date.now`**
Alternative function for returning the current date, also see [`now`](#now).

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-countdown-now",
"version": "1.1.0",
"version": "1.2.0",
"description": "A customizable countdown component for React.",
"main": "dist/Countdown.js",
"repository": {
Expand Down

0 comments on commit c45bb60

Please sign in to comment.