Title format is not configurable
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 42/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- javascript
- 领域
- frontend, localization
调研方向
从 src/relative-time-element.ts 中 issue 所链接的标题格式化代码开始,然后检查现有的格式化选项和相关测试。定义并实现标题格式化如何复用样式设置或接受独立规则,同时保留浏览器本地时区格式化;当标题支持所请求的本地化格式时即表示完成。
由索引模型根据 Issue 内容生成。
描述
Hello, and thanks for this custom element!
I am starting to use <relative-time> in an app that supports multiple languages and users are in different countries. I started with the basics and just set the datetime attribute and inner text.
I noticed the automatic title always had short months. I tried to change it by setting formatStyle="long" and month="long" to no avail. Inspecting the source I found that titles use a fixed format:
Thanks to the comment in the code above, I was able to temporarily solve for my use case by rendering the title from the server side, but that meant giving up showing the time in the timezone of the browser.
Would you consider re-using the style settings when formatting the title or provide a specific formatting rule for the title, independent from the inner text?
PS: Related, but less important, it would also be useful to add some text around the date, like title="Updated at {formatted-date-here}" (where the string "Updated at" is rendered in the correct locale on the server).
Thanks again!
- 主要语言
- JavaScript
- 星标
- 4k
- 派生
- 194
- 平均合并
- 4 天 10 小时
- 30 天内合并 PR
- 5
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
github/relative-time-element 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
github/relative-time-element#383 · 1 条评论 ·
-
Inconsistent use of "yesterday"可能重新可做 @ayushman1210 于 331 天前认领,目前没有进行中的 PR。 未关闭
难度 3/5 1-2 天 新手友好度 45/100
github/relative-time-element#313 · 1 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
github/relative-time-element#307 ·
-
Astro Support未关闭
难度 4/5 3-5 天 新手友好度 30/100
github/relative-time-element#306 · 2 条评论 ·
-
难度 3/5 1-2 天 新手友好度 35/100
github/relative-time-element#293 · 2 条评论 · 5 个 reaction ·
查看 github/relative-time-element 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 70/100
gkjohnson/three-mesh-bvh#933 ·
-
scope: curriculum status: waiting triage
难度 2/5 1-3 小时 新手友好度 72/100
freeCodeCamp/freeCodeCamp#71076 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
HarperFast/harper#3275 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
documentation good first issue help wanted
难度 2/5 1-3 小时 新手友好度 75/100
steerion-labs/bounded-agent-runtime#93 ·
维护者通常 1 天内回复