Habits & Summaries: Timezone bug?
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 78/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- javascript
调研方向
检查 Habit & Summary Charts 的坐标轴刻度标签路径,尤其是 YYYY-MM-DD 值转换为 Date 对象的地方;issue 将此处确定为可能的入口点。在 America/Denver 中使用 last-2-weeks 时间段复现,并将标签与 tooltips 进行比较。完成的标准是坐标轴标签与该时间段和 tooltips 中的日期一致,同时不改变底层数据。
由索引模型根据 Issue 内容生成。
描述
Checks
- I confirm I have restarted NotePlan and this problem still persists.
- I confirm I have reinstalled the Plugin and this problem still persists.
- Is this a repeatable problem?
System
- Device OS: macOS Version 27.0 (26A428), iOS 27.0 (24A437)
- NotePlan Version: Version 3.21.3 (1534)
- Plugin Name & Version: "Habit & Summary Charts" v1.2.0
- Timezone: America/Denver (MDT, UTC-6)
Describe the bug
Chart x-axis labels are one day earlier than the dates of the data plotted above them. Tooltips show the correct date, so the data appears to be keyed correctly and only the axis tick labels are shifted.
With Period set to "last 2 weeks" (header: 2026-09-14 - 2026-09-27), the x-axis runs Sep 13 - Sep 26.
Examples from the same view:
- @bike logged Sep 24 (16.4) and Sep 25 (30.8). The bars appear above the labels "Sep 23" and "Sep 24". Hovering them shows tooltips "Thu, 24 Sep 2026" and "Fri, 25 Sep 2026".
- @run logged Sep 15 (4.1). The bar appears above the label "Sep 14".
- Sep 13's daily note has @bike, @run and @swim entries. The chart has a "Sep 13" label with nothing above it, because that slot is really Sep 14 (Sep 13 is correctly outside the period).
Happens on both macOS and iOS.
Likely cause: the tick labels look like they're built from new Date('YYYY-MM-DD'), which JavaScript parses as UTC midnight, then formatted in local time. West of UTC, midnight UTC on Sep 14 displays as Sep 13. The tooltip seems to use a different path that gets it right. Constructing local dates for the ticks should fix it, e.g. new Date(y, m - 1, d), new Date(str + 'T00:00:00'), or moment(str, 'YYYY-MM-DD'). This wouldn't show up for anyone at UTC or east of it.
What do you expect it to do instead?
Axis labels should match the period (Sep 14 - Sep 27) and the tooltip date for each bar.
To Reproduce
- Set system timezone to one west of UTC (e.g. America/Denver)
- Log a value (e.g. @run(4.1)) in a daily note
- Open Habit & Summary Charts and choose a period containing that day
- Compare the axis label under the bar with the date in its tooltip
- See the axis label is one day earlier
Screenshots
- 主要语言
- JavaScript
- 星标
- 204
- 派生
- 83
- 平均合并
- 22 小时 27 分钟
- 30 天内合并 PR
- 3
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NotePlan/plugins 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
-
bug
难度 4/5 3-5 天 新手友好度 48/100
-
难度 5/5 一周以上 新手友好度 35/100
-
Tidy: Issue with plugin.json可能重新可做 @jgclark 于 62 天前认领,目前没有进行中的 PR。 未关闭bug
-
bug
难度 3/5 1-2 天 新手友好度 38/100
相似的 Issue
-
documentation good first issue help wanted
难度 1/5 1-3 小时 新手友好度 92/100
维护者通常 1 天内回复
-
automated issue report
难度 1/5 1 小时以内 新手友好度 85/100
lirantal/discoprint#29 ·
维护者通常 1 天内回复
-
feature-request
难度 2/5 1-3 小时 新手友好度 68/100
louislam/uptime-kuma#7914 · 1 条评论 ·
维护者通常 1 天内回复
-
Code Cleanup dependencies
难度 1/5 1 小时以内 新手友好度 68/100
ProjectSidewalk/SidewalkWebpage#5609 ·
维护者通常 1 天内回复
-
help wanted javascript
难度 2/5 1-3 小时 新手友好度 68/100
OWASP/cornucopia#3538 ·
维护者通常 1 天内回复