-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Clear and concise description of the problem
我使用useTimeAgo时需要将展示的文本替换成中文。
Suggested solution
- 其实通过options的message是可以实现的,所以我这个issue不知道合不合理?
- 下面是配置(是否考虑加到文档中做个示例?):
messages: {
justNow: '刚刚',
past: (n) => (n.match(/\d/) ? `${n}以前` : n),
future: (n) => (n.match(/\d/) ? `未来 ${n}` : n),
month: (n, past) => (n === 1 ? (past ? '上个月' : '下个月') : `${n}个月${n > 1 ? '' : ''}`),
year: (n, past) => (n === 1 ? (past ? '去年' : '明年') : `${n}年${n > 1 ? '' : ''}`),
day: (n, past) => (n === 1 ? (past ? '昨天' : '明天') : `${n}天${n > 1 ? '' : ''}`),
week: (n, past) => (n === 1 ? (past ? '上一周' : '下一周') : `${n}周${n > 1 ? '' : ''}`),
hour: (n) => `${n}小时${n > 1 ? '' : ''}`,
minute: (n) => `${n}分钟${n > 1 ? '' : ''}`,
second: (n) => `${n}秒${n > 1 ? '' : ''}`,
}
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
asamoon, iniself and randall-kangasamoon and iniself
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request