Skip to content

Commit

Permalink
Merge pull request #2332 from grncdr/patch-1
Browse files Browse the repository at this point in the history
Document return type of `date` knob (see #1489)
  • Loading branch information
Hypnosphi authored Nov 17, 2017
2 parents acf815e + 96c4226 commit e7cf067
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions addons/knobs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,16 @@ const value = date(label, defaultValue);

> Note: the default value must not change - e.g., do not do `date('Label', new Date())` or `date('Label')`
The `date` knob returns the selected date as stringified Unix timestamp (e.g. `"1510913096516"`).
If your component needs the date in a different form you can wrap the `date` function:

```
function myDateKnob(name, defaultValue) {
const stringTimestamp = date(name, defaultValue)
return new Date(stringTimestamp)
}
```

### button

Allows you to include a button and associated handler.
Expand Down

0 comments on commit e7cf067

Please sign in to comment.