我想让用Now或Just now
代替0 seconds ago
,该如何处理?
2020-12-14 21:48创建
共1个回答
UJ
游客uJLTPs
你可以通过farmatter
来实现:
<TimeAgo date={timeAgo}
formatter={(value, unit) => {
if (unit === 'second' && value < 15) return "just now";
if (unit === "second") return "few seconds ago";
if (unit === "minute") return `${value} ${value === 1 ? "minute" : "minutes"} ago`;
...
}}
/>