Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/components/header/timepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ const styles = theme => {
};
};

// 30 days
const LOOKBACK_WINDOW_MILLIS = 30*24*3600*1000;

class TimeframePicker extends Component {
constructor (props) {
super(props);
Expand Down Expand Up @@ -142,6 +145,8 @@ class TimeframePicker extends Component {
}

render () {
let minDate = new Date(Date.now() - LOOKBACK_WINDOW_MILLIS).toISOString().substr(0,10);

return (
<React.Fragment>
<FormControl>
Expand All @@ -164,13 +169,15 @@ class TimeframePicker extends Component {
>
<Paper className={ this.props.classes.modal } >
<DateTimePicker
minDate={ minDate }
value={ new Date(this.state.start || this.props.start || 0) }
onChange={ this.changeStart }
label="Start time"
showTodayButton
/>

<DateTimePicker
minDate={ minDate }
value={ new Date(this.state.end || this.props.end || 0) }
onChange={ this.changeEnd }
label="End time"
Expand Down