зеркало из https://github.com/mozilla/treeherder.git
Bug 1619739 - Fix accessibility wording for DateRangePicker (#7418)
Bug 1619739 - Fix accessibility wording for DateRangePicker Co-authored-by: Sebastian Hengst <archaeopteryx@coole-files.de>
This commit is contained in:
Родитель
feb6960d86
Коммит
6de41509b9
|
@ -1,13 +1,21 @@
|
|||
import React from 'react';
|
||||
import 'react-dates/initialize';
|
||||
import 'react-dates/lib/css/_datepicker.css';
|
||||
import { DateRangePicker as DatePickerAirbnb } from 'react-dates';
|
||||
import {
|
||||
DateRangePickerPhrases,
|
||||
DateRangePicker as DatePickerAirbnb,
|
||||
} from 'react-dates';
|
||||
import moment from 'moment';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Button } from 'reactstrap';
|
||||
|
||||
import { ISODate } from './helpers';
|
||||
|
||||
const chooseAvailableDate = function chooseAvailableDate(object) {
|
||||
const { date } = object;
|
||||
return date;
|
||||
};
|
||||
|
||||
export default class DateRangePicker extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
@ -62,7 +70,11 @@ export default class DateRangePicker extends React.Component {
|
|||
|
||||
render() {
|
||||
const { startDate, endDate, calendarFocused } = this.state;
|
||||
|
||||
const defaultPhrases = {
|
||||
chooseAvailableStartDate: chooseAvailableDate,
|
||||
chooseAvailableEndDate: chooseAvailableDate,
|
||||
...DateRangePickerPhrases,
|
||||
};
|
||||
return (
|
||||
<div className="InputFromTo d-inline-block">
|
||||
<DatePickerAirbnb
|
||||
|
@ -79,6 +91,7 @@ export default class DateRangePicker extends React.Component {
|
|||
numberOfMonths={2}
|
||||
initialVisibleMonth={() => moment().subtract(1, 'month')}
|
||||
isOutsideRange={(day) => moment().diff(day) < 0}
|
||||
phrases={defaultPhrases}
|
||||
/>
|
||||
<Button color="secondary" className="ml-3" onClick={this.updateData}>
|
||||
update
|
||||
|
|
Загрузка…
Ссылка в новой задаче