Skip to content

Commit

Permalink
Merge pull request #50 from ustczy/master
Browse files Browse the repository at this point in the history
fix bug of disabledDate and disabledTime
  • Loading branch information
veryStarters committed Feb 18, 2019
2 parents 10a040d + 8f777a0 commit 081c2e4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion demo/CalendarDemo.jsx
Expand Up @@ -124,7 +124,7 @@ class Demo extends React.Component {
</p>
<Calendar
showToday
showTime={false}
showTime={true}
allowClear={false}
showSecond={false}
locale="en-us"
Expand Down
7 changes: 7 additions & 0 deletions src/Calendar.jsx
Expand Up @@ -125,6 +125,10 @@ class Calendar extends React.Component {
return current.date();
},
disabledDate: (current) => {
if (!current) {
current = this.getDate(p.defaultOpenValue || new Date().getTime());
}

if (typeof p.disabledDate === 'function' && current) {
const date = current.clone();
date.getTime = current.valueOf;
Expand All @@ -133,6 +137,9 @@ class Calendar extends React.Component {
return false;
},
disabledTime: (current) => {
if (!current) {
current = this.getDate(p.defaultOpenValue || new Date().getTime());
}
if (typeof p.disabledTime === 'function' && current) {
const date = current.clone();
date.getTime = current.valueOf;
Expand Down

0 comments on commit 081c2e4

Please sign in to comment.