You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@texera.apache.org by gi...@apache.org on 2026/08/30 01:20:47 UTC
(texera) branch gh-readonly-queue/main/pr-8110-0ebf4c6fd4b7ec994f4419344f808c47f9a23174 created (now 05e1be4c1c)
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a change to branch gh-readonly-queue/main/pr-8110-0ebf4c6fd4b7ec994f4419344f808c47f9a23174
in repository https://gitbox.apache.org/repos/asf/texera.git
at 05e1be4c1c fix(frontend): use singular relative time units (#8110)
This branch includes the following new commits:
new 05e1be4c1c fix(frontend): use singular relative time units (#8110)
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(texera) 01/01: fix(frontend): use singular relative time units (#8110)
Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
github-merge-queue[bot] pushed a commit to branch gh-readonly-queue/main/pr-8110-0ebf4c6fd4b7ec994f4419344f808c47f9a23174
in repository https://gitbox.apache.org/repos/asf/texera.git
commit 05e1be4c1ccc5893180b5cdd6d8f378b308e94e1
Author: carloea2 <ca...@uci.edu>
AuthorDate: Sun Aug 30 01:20:25 2026 +0000
fix(frontend): use singular relative time units (#8110)
### What changes were proposed in this PR?
Relative time labels now use singular units when the value is one while
preserving plural units for every other value.
Before: `1 minutes ago`, `1 hours ago`, `1 days ago`, and `1 weeks ago`.
After: `1 minute ago`, `1 hour ago`, `1 day ago`, and `1 week ago`.
### Any related issues, documentation, discussions?
Closes #8108
### How was this PR tested?
`yarn test --include src/app/common/util/format.util.spec.ts`
`yarn format:ci`
Manual:
1. Start Texera locally from this worktree.
2. Set a local workflow creation and edit time to exactly one hour ago.
3. Open Your Work, then Workflows in Chrome.
4. Confirm both labels display `1 hour ago` while older cards retain
plural units.
### Was this PR authored or co-authored using generative AI tooling?
Generated-by: Codex
---
frontend/src/app/common/util/format.util.spec.ts | 7 ++++---
frontend/src/app/common/util/format.util.ts | 8 ++++----
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/frontend/src/app/common/util/format.util.spec.ts b/frontend/src/app/common/util/format.util.spec.ts
index 6f90683400..479412c5f1 100644
--- a/frontend/src/app/common/util/format.util.spec.ts
+++ b/frontend/src/app/common/util/format.util.spec.ts
@@ -96,6 +96,7 @@ describe("formatRelativeTime", () => {
});
it("formats sub-hour differences in minutes", () => {
+ expect(formatRelativeTime(NOW - 60 * 1000)).toBe("1 minute ago");
expect(formatRelativeTime(NOW - 5 * 60 * 1000)).toBe("5 minutes ago");
expect(formatRelativeTime(NOW - 59 * 60 * 1000)).toBe("59 minutes ago");
// boundary: just-now floors to 0
@@ -103,17 +104,17 @@ describe("formatRelativeTime", () => {
});
it("formats sub-day differences in hours", () => {
- expect(formatRelativeTime(NOW - 60 * 60 * 1000)).toBe("1 hours ago");
+ expect(formatRelativeTime(NOW - 60 * 60 * 1000)).toBe("1 hour ago");
expect(formatRelativeTime(NOW - 23 * 60 * 60 * 1000)).toBe("23 hours ago");
});
it("formats sub-week differences in days", () => {
- expect(formatRelativeTime(NOW - 24 * 60 * 60 * 1000)).toBe("1 days ago");
+ expect(formatRelativeTime(NOW - 24 * 60 * 60 * 1000)).toBe("1 day ago");
expect(formatRelativeTime(NOW - 6 * 24 * 60 * 60 * 1000)).toBe("6 days ago");
});
it("formats sub-month differences in weeks", () => {
- expect(formatRelativeTime(NOW - 7 * 24 * 60 * 60 * 1000)).toBe("1 weeks ago");
+ expect(formatRelativeTime(NOW - 7 * 24 * 60 * 60 * 1000)).toBe("1 week ago");
expect(formatRelativeTime(NOW - 3 * 7 * 24 * 60 * 60 * 1000)).toBe("3 weeks ago");
});
diff --git a/frontend/src/app/common/util/format.util.ts b/frontend/src/app/common/util/format.util.ts
index 8393559aaa..419a5945af 100644
--- a/frontend/src/app/common/util/format.util.ts
+++ b/frontend/src/app/common/util/format.util.ts
@@ -70,13 +70,13 @@ export const formatRelativeTime = (timestamp: number | undefined): string => {
const weeksAgo = Math.floor(daysAgo / 7);
if (minutesAgo < 60) {
- return `${minutesAgo} minutes ago`;
+ return `${minutesAgo} minute${minutesAgo === 1 ? "" : "s"} ago`;
} else if (hoursAgo < 24) {
- return `${hoursAgo} hours ago`;
+ return `${hoursAgo} hour${hoursAgo === 1 ? "" : "s"} ago`;
} else if (daysAgo < 7) {
- return `${daysAgo} days ago`;
+ return `${daysAgo} day${daysAgo === 1 ? "" : "s"} ago`;
} else if (weeksAgo < 4) {
- return `${weeksAgo} weeks ago`;
+ return `${weeksAgo} week${weeksAgo === 1 ? "" : "s"} ago`;
}
return new Date(timestamp).toLocaleDateString();
};