Commit d4a272b7 authored by Benjamin Bouvier's avatar Benjamin Bouvier
Browse files

Datepicker: fix subtle case of bad interaction between minDate/maxDate;

parent 783dfe36
......@@ -40,12 +40,12 @@ class DatePickerWrapper extends React.Component {
render() {
let todayButton = $t('client.datepicker.today');
let now = Date.now();
let today = moment().utc().hours(0).minutes(0).seconds(0).milliseconds(0);
let minDate;
if (this.props.minDate) {
minDate = moment(this.props.minDate);
if (this.props.minDate > now) {
if (minDate.isAfter(today)) {
todayButton = null;
}
}
......@@ -53,7 +53,7 @@ class DatePickerWrapper extends React.Component {
let maxDate;
if (this.props.maxDate) {
maxDate = moment(this.props.maxDate);
if (this.props.maxDate < now) {
if (maxDate.isBefore(today)) {
todayButton = null;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment