From 658a7526b9fffefa891b841fcd25827957b8941b Mon Sep 17 00:00:00 2001 From: Jared Laser Date: Mon, 1 Dec 2014 11:22:01 -0500 Subject: [PATCH] Add a handful of pikaday options - defaultDate - firstDay - format - maxDate - minDate - position - setDefaultDate - showWeekNumber --- src/Pikaday.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/Pikaday.js b/src/Pikaday.js index 2c4391d..c9ac230 100644 --- a/src/Pikaday.js +++ b/src/Pikaday.js @@ -6,9 +6,16 @@ var Pikaday = require('pikaday'); var ReactPikaday = React.createClass({ propTypes: { + defaultDate: React.PropTypes.object, // date object + firstDay: React.PropTypes.number, // 0-6 for day of week + format: React.PropTypes.string, // A date format. see http://momentjs.com/docs/#/parsing/string-format/ + maxDate: React.PropTypes.object, // date object + minDate: React.PropTypes.object, // date object + position: React.PropTypes.string, // one or combination of "top left bottom right" + setDefaultDate: React.PropTypes.bool, // make the `defaultDate` the initial selected value + showWeekNumber: React.PropTypes.bool, value: React.PropTypes.instanceOf(Date), onChange: React.PropTypes.func, - valueLink: React.PropTypes.shape({ value: React.PropTypes.instanceOf(Date), requestChange: React.PropTypes.func.isRequired @@ -35,7 +42,15 @@ var ReactPikaday = React.createClass({ var el = this.refs.pikaday.getDOMNode(); this._picker = new Pikaday({ + defaultDate: this.props.defaultDate ? this.props.defaultDate : new Date(), field: el, + firstDay: this.props.firstDay ? this.props.firstDay : 0, + format: this.props.format ? this.props.format : 'YYYY-MM-DD', + maxDate: this.props.maxDate, + minDate: this.props.minDate, + position: this.props.position ? this.props.position : "bottom left", + setDefaultDate: this.props.setDefaultDate ? this.props.setDefaultDate : false, + showWeekNumber: this.props.showWeekNumber, onSelect: this.getValueLink(this.props).requestChange });