-
Notifications
You must be signed in to change notification settings - Fork 843
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EuiSuperDatePicker] relative tab, timestamp: Use roundUp, switch pos with "Round To" btn #1827
Conversation
The text is displayed as _~ 69 years ago_ which is accurate, and better reflects the value after the Round to year modifier is applied. I think it would be disingenuous to users if we modify the display value. @nreese any thoughts here? |
@cchaos your thoughts as well |
Maybe it would be clearer if the rounding of the displayed date in the popover would equal the rounding of the To button's string there was some user's confusion that led to this PR, here's the original issue in the kibana repo: |
Making them the same I think it the most obvious step here. Also, I'd mov the rounding switch above the calculated date. |
Rounding the |
So when you set e.g. 70 years ago in the To field of the date range with "Round to the year" active, the To field's value is rounded up. So instead of: Jan 1, 1949 @ 00:00:00.000 It's Jan 1, 1949 @ 23:59:59.999 Since now this date is less then 70 years in the past, moment.js fromNow displays 69 years
- to sync displayed value with the value displayed in the popover button
a09853e
to
d2b2f9e
Compare
@cchaos that's the way it would look like when rounding switch would be rendered above calculated date. |
I'll defer to @nreese and @chandlerprall on the code side, but yes, I think it's worthwhile to move the switch to above the rendered(read only) date/time input. That way in both the absolute and relative, the rendered date/time is always at the bottom. However it looks like the spacing is a bit off in your screenshot. If you push the code, I can tell you how to fix the spacing. |
@@ -98,6 +95,9 @@ export class EuiRelativeTab extends Component { | |||
onChange={this.onRoundChange} | |||
/> | |||
</EuiFormRow> | |||
<EuiFormRow> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the EuiFormRow
's from wrapping the readonly text and the switch? They're not providing anything but messing up some spacing. Then you can just some spacers like so:
<EuiSpacer size="s" />
<EuiSwitch ... />
<EuiSpacer size="m" />
<EuiFieldText ... />
Which should end up looking like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, waiting for engineer to approve. You'll also need to add a CHANGELOG.md entry (just follow the pattern that is there and use past tense).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
code review, tested changes in chrome
retest |
so i've added changelog, went over the checklist, so we're ready to merge? |
Summary
So when you set e.g. 70 years ago in the To field of the date
range with "Round to the year" active, the To field's value is rounded
up. So instead of:
Jan 1, 1949 @ 00:00:00.000
It's
Jan 1, 1949 @ 23:59:59.999
Since now this date is less then 70 years in the past, moment.js fromNow
displays 69 years
Checklist
- [ ] Any props added have proper autodocs- [ ] Documentation examples were added- [ ] This was checked for breaking changes and labeled appropriately- [ ] Jest tests were updated or added to match the most common scenarios- [ ] This was checked against keyboard-only and screenreader scenarios- [ ] This required updates to Framer X components