-
Notifications
You must be signed in to change notification settings - Fork 613
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
Bug 1739225: Timestamp component always shows dates in the future as relative dates #2341
Bug 1739225: Timestamp component always shows dates in the future as relative dates #2341
Conversation
@dtaylor113: This pull request references a valid Bugzilla bug. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Hey @dtaylor113, this doesn't really fix Bug 1739225. This is more an implementation detail for Chargeback. The bug is that dates far off in the future should not be relative dates for any |
Ok, if we define what 'far off in the future' is, I can implement that fix. >9 months in the future? |
No, it should be the existing value we check which is 10.5 minutes We need to check +/- 10.5 minutes instead of assuming all dates more recent than 10.5 minutes are relative. |
0c90204
to
f9e0fb2
Compare
Ok, added a |
f9e0fb2
to
1b17699
Compare
1b17699
to
2d3af1a
Compare
@dtaylor113: This pull request references a valid Bugzilla bug. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
if (omitSuffix) { | ||
return dateTime.fromNow(mdate, undefined, {omitSuffix: true}); | ||
} | ||
if (timeAgo < 630000) { // 10.5 minutes | ||
if (timeFromNow < 630000) { // 10.5 minutes |
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.
I wouldn't assign timeFromNow
to a variable to make sure we don't accidentally use it as the date we show. (With Math.abs
it could be the wrong value.) We should add a comment explaining as well.
if (timeFromNow < 630000) { // 10.5 minutes | |
// Show a relative time if within 10.5 minutes from the current time (in the past or future). | |
if (Math.abs(now.getTime() - mdate.getTime()) < 630000) { // 10.5 minutes |
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.
changed to timeDifference
Thinking on this more, I'd recommend showing any future date as a full date. This avoids weirdness due to client clock skew where we might show something like "Build started 2 minutes from now" |
Holy crap I totally forgot about this. That is something annoying I've seen before if I recall. However, you could also fix it by taking into account the user's timezone. |
We account for timezones... The problem occurs when the user's clock is a few minutes off from the API server's (or the node's) :/ |
Ah. Either way, seems like a solid idea to fix the issue. |
2d3af1a
to
fc13764
Compare
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
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: dtaylor113, spadgett The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@dtaylor113: This pull request references a valid Bugzilla bug. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
1 similar comment
@dtaylor113: This pull request references a valid Bugzilla bug. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Why doesn't it have the year? |
Timestamp currently only shows the year if not the current year. We could look at changing that |
/retest Please review the full test history for this PR and help us cut down flakes. |
2 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
@dtaylor113: All pull requests linked via external trackers have merged. The Bugzilla bug has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Updated
Timestamp
component to only show dates 10.5 minutes in past as relative dates (ex: "2 minutes ago"). Future dates will never be displayed as relative dates, always as full dates.Before fix, dates in the future always displayed as relative:
After fix, future dates displayed as actual date (minus year if current year):
https://bugzilla.redhat.com/show_bug.cgi