Skip to content

Commit

Permalink
Add roundUp flag to displayed value of timestamp in relative tab
Browse files Browse the repository at this point in the history
- to sync displayed value with the value displayed in the
popover button
  • Loading branch information
kertal committed Apr 24, 2019
1 parent f044353 commit 0e48adf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export function EuiDatePopoverContent({ value, roundUp, onChange, dateFormat })
dateFormat={dateFormat}
value={value}
onChange={onChange}
roundUp={roundUp}
/>
),
'data-test-subj': 'superDatePickerRelativeTab',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class EuiRelativeTab extends Component {

render() {
const isInvalid = this.state.count < 0;
const parsedValue = dateMath.parse(this.props.value);
const parsedValue = dateMath.parse(this.props.value, { roundUp: this.props.roundUp });
const formatedValue = isInvalid || !parsedValue || !parsedValue.isValid()
? ''
: parsedValue.format(this.props.dateFormat);
Expand Down Expand Up @@ -107,4 +107,5 @@ EuiRelativeTab.propTypes = {
dateFormat: PropTypes.string.isRequired,
value: PropTypes.string.isRequired,
onChange: PropTypes.func.isRequired,
roundUp: PropTypes.bool
};

0 comments on commit 0e48adf

Please sign in to comment.