Skip to content

Commit 436f3eb

Browse files
fix: past time format for dayjs locale
Modify past time format in dayjs locale to handle 'now' case.
1 parent cd1efaa commit 436f3eb

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/pages/plugin/plugin.view.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ dayjs.extend(dayjsUpdateLocale);
2121
dayjs.updateLocale("en", {
2222
relativeTime: {
2323
future: "in %s",
24-
past: "%s ago",
24+
past: (value, withoutSuffix) => {
25+
if(value === "now") {
26+
return value;
27+
}
28+
return withoutSuffix ? value : `${value} ago`;
29+
},
2530
s: "now",
2631
ss: "now",
2732
m: "1m",

0 commit comments

Comments
 (0)