Skip to content

Commit 2ee7f49

Browse files
committed
chore: move dayjs config to top
1 parent fad8730 commit 2ee7f49

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/pages/plugin/plugin.view.js

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,26 @@ dayjs.extend(dayjsRelativeTime);
1717
dayjs.extend(dayjsUtc);
1818
dayjs.extend(dayjsUpdateLocale);
1919

20+
// Configure dayjs for shorter relative time format
21+
dayjs.updateLocale("en", {
22+
relativeTime: {
23+
future: "in %s",
24+
past: "%s ago",
25+
s: "now",
26+
ss: "now",
27+
m: "1m",
28+
mm: "%dm",
29+
h: "1h",
30+
hh: "%dh",
31+
d: "1d",
32+
dd: "%dd",
33+
M: "1mo",
34+
MM: "%dmo",
35+
y: "1y",
36+
yy: "%dy",
37+
},
38+
});
39+
2040
export default (props) => {
2141
const {
2242
id,
@@ -55,26 +75,6 @@ export default (props) => {
5575
if (!dateString) return null;
5676

5777
try {
58-
// Configure dayjs for shorter relative time format
59-
dayjs.updateLocale("en", {
60-
relativeTime: {
61-
future: "in %s",
62-
past: "%s ago",
63-
s: "now",
64-
ss: "now",
65-
m: "1m",
66-
mm: "%dm",
67-
h: "1h",
68-
hh: "%dh",
69-
d: "1d",
70-
dd: "%dd",
71-
M: "1mo",
72-
MM: "%dmo",
73-
y: "1y",
74-
yy: "%dy",
75-
},
76-
});
77-
7878
const updateTime = dayjs.utc(dateString);
7979
if (!updateTime.isValid()) return null;
8080

0 commit comments

Comments
 (0)