-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-16986][WEB-UI] Converter Started, Completed and Last Updated to client time zone in history page #19640
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
Changes from 6 commits
17bddef
c7339c8
f36023a
5291d16
d9994ea
7b04e08
9a40da0
cb1db11
4a78965
40ec67e
08f5e68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,8 +38,17 @@ function makeIdNumeric(id) { | |
| } | ||
|
|
||
| function formatDate(date) { | ||
| if (date <= 0) return "-"; | ||
| else return date.split(".")[0].replace("T", " "); | ||
| if (date <= 0) { | ||
| return "-"; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just for curious, what does a single
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, invalid value. Maybe we can remove this. |
||
| } else { | ||
| var dt = new Date(date); | ||
| return dt.getFullYear() + "-" + | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not familiar with js, does js have something like java
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Native Javascript does not support: Use the momentjs library seems too heavy. |
||
| ("0" + (dt.getMonth() + 1)).slice(-2) + "-" + | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this looks a bit hacky, is there any way in js to print a number to 2 letters?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about this: function formatDate(date) {
if (date <= 0) {
return "-";
} else {
var dt = new Date(date);
return dt.getFullYear() + "-" +
(dt.getMonth() + 1).toString().padStart(2, "0") + "-" +
(dt.getDate()).toString().padStart(2, "0") + " " +
(dt.getHours()).toString().padStart(2, "0") + ":" +
(dt.getMinutes()).toString().padStart(2, "0") + ":" +
(dt.getSeconds()).toString().padStart(2, "0");
}
}
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yea much better, |
||
| ("0" + dt.getDate()).slice(-2) + " " + | ||
| ("0" + dt.getHours()).slice(-2) + ":" + | ||
| ("0" + dt.getMinutes()).slice(-2) + ":" + | ||
| ("0" + dt.getSeconds()).slice(-2); | ||
| } | ||
| } | ||
|
|
||
| function getParameterByName(name, searchString) { | ||
|
|
@@ -129,9 +138,9 @@ $(document).ready(function() { | |
| var num = app["attempts"].length; | ||
| for (j in app["attempts"]) { | ||
| var attempt = app["attempts"][j]; | ||
| attempt["startTime"] = formatDate(attempt["startTime"]); | ||
| attempt["endTime"] = formatDate(attempt["endTime"]); | ||
| attempt["lastUpdated"] = formatDate(attempt["lastUpdated"]); | ||
| attempt["startTime"] = formatDate(attempt["startTimeEpoch"]); | ||
| attempt["endTime"] = formatDate(attempt["endTimeEpoch"]); | ||
| attempt["lastUpdated"] = formatDate(attempt["lastUpdatedEpoch"]); | ||
| attempt["log"] = uiRoot + "/api/v1/applications/" + id + "/" + | ||
| (attempt.hasOwnProperty("attemptId") ? attempt["attemptId"] + "/" : "") + "logs"; | ||
| attempt["durationMillisec"] = attempt["duration"]; | ||
|
|
||
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.
Move to utils.js