chore: update related time format (#1621)

chore: update related time
This commit is contained in:
boojack 2023-05-02 08:54:51 +08:00 committed by GitHub
parent 34700a4c52
commit 8911ea1619
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 29 additions and 19 deletions

View File

@ -110,7 +110,7 @@ const UsageHeatMap = () => {
// This interpolation is not being used because of the current styling,
// but it can improve translation quality by giving it a more meaningful context
const tMemoInOpts = { amount: "", period: "", date: "" };
const tMemoInOpts = { amount: memoAmount, period: "", date: "" };
return (
<>

View File

@ -121,6 +121,17 @@ export const getRelativeTimeString = (time: number, locale = i18n.language, form
const minMillis = secMillis * 60;
const hourMillis = minMillis * 60;
const dayMillis = hourMillis * 24;
// Show full date if more than 1 day ago.
if (pastTimeMillis >= dayMillis) {
return new Date(time).toLocaleDateString(locale, {
year: "numeric",
month: "numeric",
day: "numeric",
hour: "numeric",
minute: "numeric",
second: "numeric",
});
}
// numeric: "auto" provides "yesterday" for 1 day ago, "always" provides "1 day ago"
const formatOpts = { style: formatStyle, numeric: "auto" } as Intl.RelativeTimeFormatOptions;

View File

@ -110,7 +110,7 @@
"reset-link-prompt": "Are you sure to reset the link?\nThis will break all current link usages.\n\nTHIS ACTION IS IRREVERSIBLE❗",
"delete-resource": "Delete Resource",
"linked-amount": "Linked amount",
"warning-text": "Are you sure to delete this resource?\n\nTHIS ACTION IS IRREVERSIBLE❗",
"warning-text": "Are you sure to delete this resource?\n\nTHIS ACTION IS IRREVERSIBLE❗",
"warning-text-unused": "Are you sure to delete these unused resources?\n\nTHIS ACTION IS IRREVERSIBLE❗",
"no-unused-resources": "No unused resources",
"delete-selected-resources": "Delete Selected Resources",
@ -373,8 +373,8 @@
"copy": "Copy"
},
"heatmap": {
"memo-in": "{{amount}} memo in {{period}}",
"memos-in": "{{amount}} memos in {{period}}",
"memo-in": "memo in {{period}}",
"memos-in": "memos in {{period}}",
"memo-on": "{{amount}} memo on {{date}}",
"memos-on": "{{amount}} memos on {{date}}",
"day": "day",
@ -387,4 +387,4 @@
"powered-by": "Powered by",
"other-projects": "Other Projects"
}
}
}

View File

@ -373,8 +373,8 @@
"copy": "복사"
},
"heatmap": {
"memo-in": "{{period}}동안 메모 {{amount}}개 작성",
"memos-in": "{{period}}동안 메모 {{amount}}개 작성",
"memo-in": "동안 메모 {{amount}}개 작성",
"memos-in": "동안 메모 {{amount}}개 작성",
"memo-on": "{{date}}에 메모 {{amount}}개 작성",
"memos-on": "{{date}}에 메모 {{amount}}개 작성",
"day": "일",

View File

@ -110,7 +110,7 @@
"reset-link-prompt": "Tem certeza de que deseja redefinir o link?\nIsso quebrará todos os vínculos atuais.\n\nESTA AÇÃO É IRREVERSÍVEL❗",
"delete-resource": "Deletar recurso",
"linked-amount": "Quantidade de vínculos",
"warning-text": "Tem certeza de que deseja deletar este recurso?\n\nESTA AÇÃO É IRREVERSÍVEL❗",
"warning-text": "Tem certeza de que deseja deletar este recurso?\n\nESTA AÇÃO É IRREVERSÍVEL❗",
"warning-text-unused": "Tem certeza de que deseja deletar este recurso não utilizado?\n\nESTA AÇÃO É IRREVERSÍVEL❗",
"no-unused-resources": "Nenhum recurso não utilizado",
"delete-selected-resources": "Deletar recursos selecionados",
@ -373,8 +373,8 @@
"copy": "Copiar"
},
"heatmap": {
"memo-in": "{{amount}} memo em {{period}}",
"memos-in": "{{amount}} memos em {{period}}",
"memo-in": "memo em {{period}}",
"memos-in": "memos em {{period}}",
"memo-on": "{{amount}} memo em {{date}}",
"memos-on": "{{amount}} memos em {{date}}",
"day": "dia",

View File

@ -98,7 +98,7 @@
"username": "用户名",
"vacuum": "清理未使用资源",
"version": "版本",
"visibility": "可见",
"visibility": "可见",
"yourself": "你自己"
},
"daily-review": {
@ -155,7 +155,7 @@
"tag": "标签",
"text": "文本",
"type": "类型",
"visibility": "可见"
"visibility": "可见"
},
"value": {
"has-attachment": "包含附件",
@ -166,9 +166,9 @@
"heatmap": {
"day": "天",
"days": "天",
"memo-in": "{{period}} 记了 {{amount}} 条备忘录",
"memo-in": " 条 memos",
"memos-in": " 条 memos",
"memo-on": "{{date}} 记了 {{amount}} 条备忘录",
"memos-in": "{{period}} 记了 {{amount}} 条备忘录",
"memos-on": "{{date}} 记了 {{amount}} 条备忘录"
},
"memo": {
@ -324,7 +324,6 @@
"daily-review-time-offset": "每日回顾时间偏移",
"default-memo-sort-option": "备忘录显示时间",
"default-memo-visibility": "默认备忘录可见性",
"default-resource-visibility": "默认资源可见度",
"editor-font-style": "编辑器字体样式",
"enable-double-click": "开启双击编辑",
"enable-folding-memo": "开启折叠备忘录",
@ -428,4 +427,4 @@
"tag-name": "标签名称",
"tip-text": "输入`#tag`来创建标签"
}
}
}

View File

@ -110,7 +110,7 @@
"reset-link-prompt": "您確定要重設連結?\n這將會破壞所有目前的使用中的連結。\n\n此動作為不可逆❗",
"delete-resource": "刪除資源",
"linked-amount": "連結的 Memo 數量",
"warning-text": "您確定要刪除此資源?\n\n此動作為不可逆❗",
"warning-text": "您確定要刪除此資源?\n\n此動作為不可逆❗",
"warning-text-unused": "您確定要刪除這些未使用的資源?\n\n此動作為不可逆❗",
"no-unused-resources": "無未使用的資源",
"delete-selected-resources": "刪除所選的資源",
@ -373,8 +373,8 @@
"copy": "複製"
},
"heatmap": {
"memo-in": "{{amount}} memo in {{period}}",
"memos-in": "{{amount}} memos in {{period}}",
"memo-in": "memo in {{period}}",
"memos-in": "memos in {{period}}",
"memo-on": "{{amount}} memo on {{date}}",
"memos-on": "{{amount}} memos on {{date}}",
"day": "天",