Skip to content
This repository was archived by the owner on Jul 21, 2021. It is now read-only.

Commit 7a2fcf6

Browse files
committed
Merge pull request quri#30 from mattdell/inputprops
Custom input attributes
2 parents e44fda3 + 4cdcdbd commit 7a2fcf6

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ DateTimeField
3737
| **onChange** | function | x => console.log(x) | Callback trigger when the date changes |
3838
| **showToday** | boolean | true | Highlights today's date |
3939
| **daysOfWeekDisabled** | array of integer | [] | Disables clicking on some days. Goes from 0 (Sunday) to 6 (Saturday). |
40-
| ** viewMode ** | string or number | 'days' | The default view to display when the picker is shown. ('years', 'months', 'days') |
40+
| **viewMode** | string or number | 'days' | The default view to display when the picker is shown. ('years', 'months', 'days') |
41+
| **inputProps** | object | undefined | Defines additional attributes for the input element of the component. |
4142

4243
Update Warning
4344
===============================

src/DateTimeField.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ DateTimeField = React.createClass({
1313
dateTime: React.PropTypes.string,
1414
onChange: React.PropTypes.func,
1515
format: React.PropTypes.string,
16-
inputFormat: React.PropTypes.string
16+
inputFormat: React.PropTypes.string,
17+
inputProps: React.PropTypes.object
1718
},
1819
getDefaultProps: function() {
1920
return {
@@ -285,7 +286,7 @@ DateTimeField = React.createClass({
285286
togglePeriod={this.togglePeriod}
286287
/>
287288
<div className="input-group date" ref="datetimepicker">
288-
<input type="text" className="form-control" onChange={this.onChange} value={this.state.inputValue} />
289+
<input type="text" className="form-control" onChange={this.onChange} value={this.state.inputValue} {...this.props.inputProps}/>
289290
<span className="input-group-addon" onClick={this.onClick} onBlur={this.onBlur} ref="dtpbutton"><Glyphicon glyph="calendar" /></span>
290291
</div>
291292
</div>

0 commit comments

Comments
 (0)