Simon Egersand
2018-02-07 de3fe15c59e7692eda6058a0dc8d0271acbcf3a3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import React, { Component } from 'react';
import DateTime from 'react-datetime';
 
export default class ValidatedExample extends Component {
  render() {
    return (
      <div>
        <h2>isValidDate</h2>
        <p>You can use "isValidDate" to disable all dates after last month.</p>
        <DateTime
          viewMode="months"
          dateFormat="MMMM"
          isValidDate={(current) =>
            current.isBefore(DateTime.moment().startOf('month'))
          }
          onChange={console.log}
        />
      </div>
    );
  }
}