Skip to content

Commit 1b6c0fc

Browse files
committed
add /*
1 parent 811788c commit 1b6c0fc

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

DateTime.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ declare namespace ReactDatetimeClass {
6767
datepicker on input focus and close it on click outside.
6868
*/
6969
open?: boolean;
70+
/*
71+
TODO
72+
*/
73+
changeOnClickOverMonth?: boolean;
7074
/*
7175
Manually set the locale for the react-datetime instance.
7276
Moment.js locale needs to be loaded to be used, see i18n docs.
@@ -174,6 +178,7 @@ declare namespace ReactDatetimeClass {
174178
selectedDate: Moment;
175179
inputValue: string;
176180
open: boolean;
181+
changeOnClickOverMonth: boolean;
177182
}
178183
}
179184

DateTime.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ var Datetime = createClass({
3434
// dateFormat: TYPES.string | TYPES.bool,
3535
// timeFormat: TYPES.string | TYPES.bool,
3636
inputProps: TYPES.object,
37+
changeOnClickOverMonth: TYPES.bool,
3738
timeConstraints: TYPES.object,
3839
viewMode: TYPES.oneOf([viewModes.YEARS, viewModes.MONTHS, viewModes.DAYS, viewModes.TIME]),
3940
isValidDate: TYPES.func,
@@ -318,11 +319,12 @@ var Datetime = createClass({
318319
;
319320

320321
if (target.className.indexOf('rdtDay') !== -1) {
321-
if (target.className.indexOf('rdtNew') !== -1)
322-
modifier = 1;
323-
else if (target.className.indexOf('rdtOld') !== -1)
324-
modifier = -1;
325-
322+
if (this.props.changeOnClickOverMonth) {
323+
if (target.className.indexOf('rdtNew') !== -1)
324+
modifier = 1;
325+
else if (target.className.indexOf('rdtOld') !== -1)
326+
modifier = -1;
327+
}
326328
date = viewDate.clone()
327329
.month( viewDate.month() + modifier )
328330
.date( parseInt( target.getAttribute('data-value'), 10 ) );
@@ -475,6 +477,7 @@ Datetime.defaultProps = {
475477
strictParsing: true,
476478
closeOnSelect: false,
477479
closeOnTab: true,
480+
changeOnClickOverMonth: true,
478481
utc: false
479482
};
480483

0 commit comments

Comments
 (0)