From 689227efa649efc14117929a316bb3962cd7af7b Mon Sep 17 00:00:00 2001
From: Simon Egersand <s.egersand@gmail.com>
Date: Mon, 13 Nov 2017 21:00:42 +0100
Subject: [PATCH] Pass event to onFocus event handler

---
 DateTime.js |    6 +++---
 README.md   |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/DateTime.js b/DateTime.js
index 14ce13e..670d8c4 100644
--- a/DateTime.js
+++ b/DateTime.js
@@ -351,10 +351,10 @@
 		this.props.onChange( date );
 	},
 
-	openCalendar: function() {
-		if (!this.state.open) {
+	openCalendar: function( e ) {
+		if ( !this.state.open ) {
 			this.setState({ open: true }, function() {
-				this.props.onFocus();
+				this.props.onFocus( e );
 			});
 		}
 	},
diff --git a/README.md b/README.md
index 7f8b392..d3ace24 100644
--- a/README.md
+++ b/README.md
@@ -50,7 +50,7 @@
 | **locale** | `string` | `null` | Manually set the locale for the react-datetime instance. Moment.js locale needs to be loaded to be used, see [i18n docs](#i18n).
 | **utc** | `boolean` | `false` | When true, input time values will be interpreted as UTC (Zulu time) by Moment.js. Otherwise they will default to the user's local timezone.
 | **onChange** | `function` | empty function | Callback trigger when the date changes. The callback receives the selected `moment` object as only parameter, if the date in the input is valid. If the date in the input is not valid, the callback receives the value of the input (a string). |
-| **onFocus** | `function` | empty function | Callback trigger for when the user opens the datepicker. |
+| **onFocus** | `function` | empty function | Callback trigger for when the user opens the datepicker. The callback receives an event of type SyntheticEvent. |
 | **onBlur** | `function` | empty function | Callback trigger for when the user clicks outside of the input, simulating a regular onBlur. The callback receives the selected `moment` object as only parameter, if the date in the input is valid. If the date in the input is not valid, the callback returned. |
 | **onViewModeChange** | `function` | empty function | Callback trigger when the view mode changes. The callback receives the selected view mode string (`years`, `months`, `days` or `time`) as only parameter.|
 | **viewMode** | `string` or `number` | `'days'` | The default view to display when the picker is shown (`'years'`, `'months'`, `'days'`, `'time'`). |

--
Gitblit v1.9.3