Relative timestamps (<t:…:R>) show wrong direction and size past ~4 weeks ("in 0 months" for a date 2 years ago)
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 35/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- frontend
调研方向
Read timeAgo in packages/markups/src/elements/TimestampElement.js; the seconds-through-weeks branches are correct, so focus on the months and years branches that subtract only getMonth() / getFullYear() and lose the sign. Run the existing markup tests for TimestampElement with the four examples from the issue (36 days, 13 months, exactly 2 years, 66 days future) to confirm the failures before changing the elapsed-month calculation and rounding. Note that pull request #1426 is already open against this issue, so check its state before starting.
由索引模型根据 Issue 内容生成。
描述
Description:
Relative timestamp markup (<t:UNIX:R>) is rendered by timeAgo in packages/markups/src/elements/TimestampElement.js. Seconds through weeks are derived from the elapsed time, but months and years are computed by subtracting only the calendar month and year numbers (getMonth() / getFullYear()). Once a timestamp is 4+ weeks away, the result ignores the year and gets the wrong sign across New Year:
- 36 days ago (Dec 20 viewed on Jan 25) → "in 11 months"
- 13 months ago → "1 month ago"
- exactly 2 years ago (same calendar month) → "in 0 months"
- 66 days in the future (Jan 20 viewed on Nov 15) → "10 months ago"
Steps to reproduce:
- During November 2026, send a message containing
<t:1731672000:R>(Nov 15 2024). - Send
<t:1760529600:R>(Oct 15 2025) and<t:1768867200:R>(Jan 20 2027). - Look at the rendered timestamps in EmbeddedChat.
Expected behavior:
"2 years ago", "1 year ago" and "in 2 months".
Actual behavior:
"in 0 months", "1 month ago" and "10 months ago".
- 主要语言
- JavaScript
- 星标
- 170
- 派生
- 397
- 平均合并
- 12 天 14 小时
- 30 天内合并 PR
- 6
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
RocketChat/EmbeddedChat 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 75/100
RocketChat/EmbeddedChat#1429 ·
维护者通常 1 天内回复
-
docs: README says Node 22 is required, but .nvmrc pins v24 and preinstall enforces it可能已有人在做 @Veerpratapgupta 于 29 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 88/100
RocketChat/EmbeddedChat#1377 · 1 条评论 ·
维护者通常 1 天内回复
-
test: isMessageSequential in layout_editor has no coverage可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
RocketChat/EmbeddedChat#1373 ·
维护者通常 1 天内回复
-
Permissions change-detection in useFetchChatData is dead — applyPermissions re-runs on every call可能已有人在做 @yash113gadia 于 166 天前认领。 未关闭
难度 1/5 1 小时以内 新手友好度 85/100
RocketChat/EmbeddedChat#1317 ·
维护者通常 1 天内回复
-
Only the last emoji shortname in a message is converted to unicode可能已有人在做 @yash113gadia 于 167 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
RocketChat/EmbeddedChat#1315 ·
维护者通常 1 天内回复
查看 RocketChat/EmbeddedChat 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 88/100
webtorrent/webtorrent#3131 ·
-
good first issue
难度 2/5 1-3 小时 新手友好度 88/100
trustjonathan/STUDY-HUB#15 ·
-
难度 1/5 1 小时以内 新手友好度 68/100
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100