From ba9fb0be262e710f93002057856a555876dcc6dc Mon Sep 17 00:00:00 2001 From: kristiansorens Date: Fri, 29 Apr 2016 13:11:20 +0200 Subject: [PATCH] Update MonthView.js to handle hover on date --- lib/MonthView.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/MonthView.js b/lib/MonthView.js index d032ea7d..c6acb2e4 100644 --- a/lib/MonthView.js +++ b/lib/MonthView.js @@ -209,6 +209,7 @@ var MonthView = React.createClass({ className: classes.join(' '), style: {}, onClick: this.handleClick.bind(this, props, date, dateTimestamp), + onMouseEnter: this.handleHover.bind(this, props, date, dateTimestamp), children: dayText }; @@ -278,6 +279,18 @@ var MonthView = React.createClass({ } event.target.value = date;(props.onChange || emptyFn)(date, event); + }, + + handleHover: function handleHover(props, date, timestamp, event) { + + if (props.minDate && timestamp < props.minDate) { + return; + } + if (props.maxDate && timestamp > props.maxDate) { + return; + } + + event.target.value = date;(props.handleHover || emptyFn)(date, event); } }); @@ -288,4 +301,4 @@ MonthView.getHeaderText = function (moment, props) { module.exports = MonthView; // debugger -// clone.add(this.props.weekStartDay, 'days') \ No newline at end of file +// clone.add(this.props.weekStartDay, 'days')