Skip to content

Commit

Permalink
support today button to select. Fixes #17
Browse files Browse the repository at this point in the history
  • Loading branch information
yiminghe committed Mar 23, 2015
1 parent 61cd01b commit b361739
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
5 changes: 4 additions & 1 deletion HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# History
----

generated by https://github.com/yiminghe/gh-history

## 3.1.0 / 2015-03-23

`improved` [#17](https://github.com/react-component/calendar/issues/17) support today button to select

## 3.0.0 / 2015-03-13

Expand Down
8 changes: 3 additions & 5 deletions lib/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,21 +101,19 @@ function onBlur() {
function chooseToday() {
var today = this.state.value.clone();
today.setTime(Date.now());
this.setState({
value: today
});
this.handleSelect(today);
}

function handleDayClick(current) {
this.handleSelect(current);
}

function handleSelect(current, event) {
function handleSelect(current, keyDownEvent) {
var props = this.props;
this.setState({
value: current
});
if (!event) {
if (!keyDownEvent) {
props.onSelect(current);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class Picker extends React.Component {
offset = [0, -5];
}

var align = domAlign(React.findDOMNode(this.calendarInstance), this.inputInstance.getDOMNode(), {
var align = domAlign(React.findDOMNode(this.calendarInstance), React.findDOMNode(this.inputInstance), {
points: points,
offset: offset,
overflow: {
Expand Down
2 changes: 1 addition & 1 deletion lib/Time.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function keyDownWrap(method, min, max) {
number = loop(number, min, max);
var time = this.props.value.clone();
time[method](number);
this.props.onChange(time, 1);
this.props.onChange(time, e);
}
};
}
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": "rc-calendar",
"version": "3.0.1",
"version": "3.1.0",
"description": "calendar ui component for react",
"keywords": [
"react",
Expand Down

0 comments on commit b361739

Please sign in to comment.