Skip to content

Commit 8335317

Browse files
committed
Version 2.9.0
1 parent b8d07e8 commit 8335317

File tree

5 files changed

+21
-15
lines changed

5 files changed

+21
-15
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Changelog
22
=========
3+
## 2.9.0
4+
* Trigger callback method on view mode changes
5+
36
## 2.8.11
47
* Update TypeScript definitions
58
* Replace deprecated React method with non-deprecated method

dist/react-datetime.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ return /******/ (function(modules) { // webpackBootstrap
6262
'use strict';
6363

6464
var assign = __webpack_require__(1),
65-
PropTypes = __webpack_require__(2),
66-
createClass = __webpack_require__(11),
65+
PropTypes = __webpack_require__(2),
66+
createClass = __webpack_require__(11),
6767
moment = __webpack_require__(16),
6868
React = __webpack_require__(12),
6969
CalendarContainer = __webpack_require__(17)
@@ -77,6 +77,7 @@ return /******/ (function(modules) { // webpackBootstrap
7777
onFocus: TYPES.func,
7878
onBlur: TYPES.func,
7979
onChange: TYPES.func,
80+
onViewModeChange: TYPES.func,
8081
locale: TYPES.string,
8182
utc: TYPES.bool,
8283
input: TYPES.bool,
@@ -102,6 +103,7 @@ return /******/ (function(modules) { // webpackBootstrap
102103
onFocus: nof,
103104
onBlur: nof,
104105
onChange: nof,
106+
onViewModeChange: nof,
105107
timeFormat: true,
106108
timeConstraints: {},
107109
dateFormat: true,
@@ -162,13 +164,11 @@ return /******/ (function(modules) { // webpackBootstrap
162164
},
163165

164166
getUpdateOn: function( formats ) {
165-
if ( formats.date.match(/[lLD]/) ) {
167+
if ( formats.date.match(/[lLD]/) ) {
166168
return 'days';
167-
}
168-
else if ( formats.date.indexOf('M') !== -1 ) {
169+
} else if ( formats.date.indexOf('M') !== -1 ) {
169170
return 'months';
170-
}
171-
else if ( formats.date.indexOf('Y') !== -1 ) {
171+
} else if ( formats.date.indexOf('Y') !== -1 ) {
172172
return 'years';
173173
}
174174

@@ -266,8 +266,7 @@ return /******/ (function(modules) { // webpackBootstrap
266266
if ( localMoment.isValid() && !this.props.value ) {
267267
update.selectedDate = localMoment;
268268
update.viewDate = localMoment.clone().startOf('month');
269-
}
270-
else {
269+
} else {
271270
update.selectedDate = null;
272271
}
273272

@@ -285,6 +284,7 @@ return /******/ (function(modules) { // webpackBootstrap
285284
showView: function( view ) {
286285
var me = this;
287286
return function() {
287+
me.state.currentView !== view && me.props.onViewModeChange( view );
288288
me.setState({ currentView: view });
289289
};
290290
},
@@ -301,6 +301,7 @@ return /******/ (function(modules) { // webpackBootstrap
301301
viewDate: me.state.viewDate.clone()[ type ]( parseInt(e.target.getAttribute('data-value'), 10) ).startOf( type ),
302302
currentView: nextViews[ type ]
303303
});
304+
me.props.onViewModeChange( nextViews[ type ] );
304305
};
305306
},
306307

@@ -357,7 +358,7 @@ return /******/ (function(modules) { // webpackBootstrap
357358
viewDate = this.state.viewDate,
358359
currentDate = this.state.selectedDate || viewDate,
359360
date
360-
;
361+
;
361362

362363
if (target.className.indexOf('rdtDay') !== -1) {
363364
if (target.className.indexOf('rdtNew') !== -1)
@@ -2670,6 +2671,8 @@ return /******/ (function(modules) { // webpackBootstrap
26702671
/* 17 */
26712672
/***/ (function(module, exports, __webpack_require__) {
26722673

2674+
'use strict';
2675+
26732676
var React = __webpack_require__(12),
26742677
createClass = __webpack_require__(11),
26752678
DaysView = __webpack_require__(18),
@@ -2703,7 +2706,7 @@ return /******/ (function(modules) { // webpackBootstrap
27032706
var React = __webpack_require__(12),
27042707
createClass = __webpack_require__(11),
27052708
moment = __webpack_require__(16),
2706-
onClickOutside = __webpack_require__(19)
2709+
onClickOutside = __webpack_require__(19)
27072710
;
27082711

27092712
var DateTimePickerDays = onClickOutside( createClass({

dist/react-datetime.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/react-datetime.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-datetime",
3-
"version": "2.8.11",
3+
"version": "2.9.0",
44
"description": "A lightweight but complete datetime picker React.js component.",
55
"homepage": "https://github.com/YouCanBookMe/react-datetime",
66
"repository": {

0 commit comments

Comments
 (0)