forked from Hacker0x01/react-datepicker
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add basic month picker * Added new option of Month/Year picker * Add tests
- Loading branch information
1 parent
57bafc0
commit 4ac5d4d
Showing
10 changed files
with
2,089 additions
and
765 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from "react"; | ||
import DatePicker from "react-datepicker"; | ||
|
||
export default class MonthPicker extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
startDate: new Date() | ||
}; | ||
} | ||
|
||
handleChange = date => { | ||
this.setState({ | ||
startDate: date | ||
}); | ||
}; | ||
|
||
render() { | ||
return ( | ||
<div className="row"> | ||
<pre className="column example__code"> | ||
<code className="jsx"> | ||
{` | ||
<DatePicker | ||
selected={this.state.startDate} | ||
onChange={this.handleChange} | ||
dateFormat="MM/yyyy" | ||
showMonthYearPicker | ||
/> | ||
`} | ||
</code> | ||
</pre> | ||
<div className="column"> | ||
<DatePicker | ||
selected={this.state.startDate} | ||
onChange={this.handleChange} | ||
dateFormat="MM/yyyy" | ||
showMonthYearPicker | ||
/> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.