Yicong-Huang commented on code in PR #5220:
URL: https://github.com/apache/texera/pull/5220#discussion_r3302159303
##########
frontend/src/app/dashboard/component/user/list-item/list-item.component.ts:
##########
@@ -372,31 +373,7 @@ export class ListItemComponent implements OnChanges {
}
}
- formatTime(timestamp: number | undefined): string {
- if (timestamp === undefined) {
- return "Unknown"; // Return "Unknown" if the timestamp is undefined
- }
-
- const currentTime = new Date().getTime();
- const timeDifference = currentTime - timestamp;
-
- const minutesAgo = Math.floor(timeDifference / (1000 * 60));
- const hoursAgo = Math.floor(timeDifference / (1000 * 60 * 60));
- const daysAgo = Math.floor(timeDifference / (1000 * 60 * 60 * 24));
- const weeksAgo = Math.floor(daysAgo / 7);
-
- if (minutesAgo < 60) {
- return `${minutesAgo} minutes ago`;
- } else if (hoursAgo < 24) {
- return `${hoursAgo} hours ago`;
- } else if (daysAgo < 7) {
- return `${daysAgo} days ago`;
- } else if (weeksAgo < 4) {
- return `${weeksAgo} weeks ago`;
- } else {
- return new Date(timestamp).toLocaleDateString();
- }
- }
+ formatRelativeTime = formatRelativeTime;
Review Comment:
Just wonder why are these rename to the same name needed?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]