-
Notifications
You must be signed in to change notification settings - Fork 108
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
End time column update #3587
End time column update #3587
Conversation
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.
Looks good...but somehow my "second thought" got lost, so I've recreated it below. 🙁
@@ -295,7 +295,7 @@ export const NewRunsRow = (props) => { | |||
onDateSelect={props.onDateSelect} | |||
/> | |||
) : ( | |||
formatDateTime(item.metadata.server.deletion) | |||
item.metadata.server.deletion |
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.
Augh! Apparently I failed to commit my "second thought" on my previous review! 😬 My apologies, Varshini!!
My concern here is that the Dashboard should not be relying on the Server to provide the deletion date in the format which the Dashboard requires. That is, we should be separating "representation" from "presentation": the Dashboard should be taking the value provided by the Server (which is a "date" of some sort) and doing its own formatting of it.
So, I suggest creating a new function, e.g.,
export const formatDate = (dateString) => {
const dateObj = new Date(dateString + "Z"); // Make sure it's in UTC
const formObj = new Intl.DateTimeFormat("en-US", {dateStyle: "medium"})
return formObj.format(dateObj);
};
and then calling that here (and at line 376) instead of formatDateTime()
.
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.
Whoa there: datestring + "Z"
is very definitely "relying on the Server date representation". There has to be a better way to force the Date
object to UTC.
Secondarily ... server.deletion
is a date, not a date-time. Yeah, for display formatting we need to force it to UTC because we don't want to show the wrong localized date; but showing just the normalized date would be better.
It seems Varshini's code avoids this complication by just displaying the server.deletion
value directly. Given the inexact nature of the value (we don't guarantee exactly when or if the server will make a deletion pass), I think that's fine for now.
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.
Whoa there:
datestring + "Z"
is very definitely "relying on the Server date representation".
I'm not sure that there is any problem with relying on the Server's representation. What I objected to is presenting the raw value from the Server directly to the user -- I wanted that presentation separated from the original representation.
All that the code adding the Z
depends on is that the string from the Server lacks a time zone designator; it'll work with basically anything which looks like a date or time -- it just ensures that Javascript interprets it as UTC.
showing just the normalized date would be better.
That's exactly what (I believe) my suggested code does. (That is, even if the dateString
includes time information, it will still return only the date portion.)
It seems Varshini's code avoids this complication
Yeah...it reports what the Server said...and, as long as we stick with that string and never hint to Javascript that it's actually a date, we'll be fine...but, it would be better if the Dashboard owned the presentation.
8b2234e
to
d756d5a
Compare
@@ -295,7 +295,7 @@ export const NewRunsRow = (props) => { | |||
onDateSelect={props.onDateSelect} | |||
/> | |||
) : ( | |||
formatDateTime(item.metadata.server.deletion) | |||
item.metadata.server.deletion |
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.
Whoa there: datestring + "Z"
is very definitely "relying on the Server date representation". There has to be a better way to force the Date
object to UTC.
Secondarily ... server.deletion
is a date, not a date-time. Yeah, for display formatting we need to force it to UTC because we don't want to show the wrong localized date; but showing just the normalized date would be better.
It seems Varshini's code avoids this complication by just displaying the server.deletion
value directly. Given the inexact nature of the value (we don't guarantee exactly when or if the server will make a deletion pass), I think that's fine for now.
* PBENCH-1307 End time column update
PBENCH-1307
End time column update
Server deletion date is obtained as string in the format
YYYY-MM-DD
from the response, removed the formatting.Edit feature is available for Server deletion column so it would be better to maintain the column.