# 已升级。现有的日历事件已从本地时间转换为UTC时间

**URL:** <https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653>\
**Category:** Bug\
**Tags:** events\
**Created:** [2024年十二月20日 15:54 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653 "2024-12-20T15:54:05Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![tkforbes](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tkforbes](https://meta.discourse.org/u/tkforbes)\
**Post date:** [2024年十二月20日 15:54 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653/1 "2024-12-20T15:54:05Z")

</div>

我今天早上运行了 `./laucher app rebuild`（也有其他升级方式，比如图形用户界面）。

这是“管理”页面上当前的详细信息。

 ![The image shows the version information for a software project, indicating that the version installed is the same as the latest version. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/5/5/a/55a4e37577ddd5e7fb0a00bc7c92571f4ffeef00.png)

我的 Discourse 有一个非常活跃的日历。所有预定义的事件开始和结束时间都从本地时间重置为 UTC。这对我的社区产生了重大影响。

 ![The image is a notification about an event titled "Operations 2024-12-22 rev.2," which occurred on December 22, 2024, from 2:00 PM to 10:30 PM. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/e/4/9/e497631e67bc191b2f69e6ce1bd13f0c9c229573.png)

该事件被定义为上午 9 点到下午 5:30。

---

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [2024年十二月20日 16:00 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653/2 "2024-12-20T16:00:31Z")

</div>

可以给我们展示一下定义事件的帖子的原始内容吗？

---

<div class="post-metadata">

**Author:** ![tkforbes](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tkforbes](https://meta.discourse.org/u/tkforbes)\
**Post date:** [2024年十二月20日 16:01 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653/3 "2024-12-20T16:01:27Z")

</div>

实际上，该事件只是显示 UTC 时间。单击（或可能将鼠标悬停在）事件上会显示此信息。

 ![日历条目显示 2024 年 12 月 22 日在多伦多、巴黎和洛杉矶的各种运营时间。（由 AI 标注）](https://global.discourse-cdn.com/meta/original/4X/9/0/4/9040774f4679e3a0df081e4816c35704eed5529b.png)

---

<div class="post-metadata">

**Author:** ![tkforbes](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tkforbes](https://meta.discourse.org/u/tkforbes)\
**Post date:** [2024年十二月20日 16:12 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653/4 "2024-12-20T16:12:09Z")

</div>

很奇怪。我现在看到了各种情况：

1. 作为另一位用户，访问的事件显示本地时间。
2. 作为管理员，一个事件是 UTC。刷新后，事件更新为本地时间。
3. 作为管理员，选择了另一个事件。显示本地时间。
4. 作为管理员，该 12 月 22 日的事件仍显示为 UTC。
5. 作为另一位用户，该 12 月 22 日的事件显示为本地时间。

我很高兴我有一个截图，否则我会认为我疯了。

---

<div class="post-metadata">

**Author:** ![tkforbes](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tkforbes](https://meta.discourse.org/u/tkforbes)\
**Post date:** [2024年十二月20日 16:17 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653/5 "2024-12-20T16:17:02Z")

</div>

```plaintext
[event start="2024-12-22 09:00" status="standalone" timezone="America/Toronto" end="2024-12-22 17:30" reminders="bumpTopic.3.days" allowedGroups="trust_level_0"]
[/event]

```

---

<div class="post-metadata">

**Author:** ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)\
**Post date:** [2024年十二月20日 16:19 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653/6 "2024-12-20T16:19:42Z")

</div>

根据猜测，这些帖子可能需要重新烘焙，而您的服务器正在处理它们并使用更新的格式重新烘焙它们。

在一个仍然看起来“错误”的帖子中，如果您强制重新烘焙：

 ![一个菜单，其中包含审核历史记录、添加员工颜色、添加员工通知、更改所有者、授予徽章、锁定帖子、制作维基、重建 HTML 和添加用户注释等选项。（由 AI 题注）](https://global.discourse-cdn.com/meta/original/4X/7/a/4/7a4c3ba7657b32e3f8e7ef315c162b3a5f87c653.png)

它看起来对吗？

---

<div class="post-metadata">

**Author:** ![tkforbes](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tkforbes](https://meta.discourse.org/u/tkforbes)\
**Post date:** [2024年十二月20日 16:23 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653/7 "2024-12-20T16:23:49Z")

</div>

我太晚了。我刷新了示例页面，事件已更新为本地时间。

如果我发现另一个有问题事件，我会尝试你的建议。

我将补充说，我的更新已在 5 小时前完成。它不是一个大型网站。它也不是一个强大的服务器，但它足够了。

---

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [2024年十二月20日 18:03 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653/8 "2024-12-20T18:03:59Z")

</div>

这是本地日期的一个问题，有时它们不会应用到日历上，我们已知晓，我将在不久的将来尝试修复。

---

<div class="post-metadata">

**Author:** ![tkforbes](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tkforbes](https://meta.discourse.org/u/tkforbes)\
**Post date:** [2024年十二月20日 21:35 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653/10 "2024-12-20T21:35:52Z")

</div>

我現在可以確認，重新烘焙確實導致了更新。

身為管理員，我發現了這個事件……

 ![Screenshot from 2024-12-20 16-32-10](https://global.discourse-cdn.com/meta/original/4X/9/4/7/9474b48d2cbddc3c03c5b6f300903808ff25c17f.png)

然後使用了「重建 HTML」選項，結果如下……

 ![The image shows a callout that is expired, created by an admin on December 14, 9:00 AM to 5:30 PM, with 0 going. (Captioned by AI)](https://global.discourse-cdn.com/meta/original/4X/9/6/a/96a8c85a6c974b9877659eff6272d51099629743.png)

---

<div class="post-metadata">

**Author:** ![tkforbes](https://avatars.discourse-cdn.com/v4/letter/t/e95f7d/32.png) [@tkforbes](https://meta.discourse.org/u/tkforbes)\
**Post date:** [2024年十二月20日 21:44 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653/11 "2024-12-20T21:44:09Z")

</div>

`重新生成 HTML` 选项似乎没有必要。我只需刷新页面即可获得正确的结果。不过，这很烦人，因为从“即将发生的事件”日历导航到事件会给我错误的事件时间。会员希望每次都能看到可靠的结果。

我认为我还没有发现除管理员以外的任何用户出现显示时间不正确的案例。

---

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [2025年一月6日 08:47 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653/12 "2025-01-06T08:47:24Z")

</div>

我几天前推送了一个修复程序，应该可以解决这个问题：

> <https://github.com/discourse/discourse-calendar/commit/46c93b81f025bdea343308ba4034da37b725daa8>
>
> The next ensures \`this.htmlDates\` has correctly been set and a render is on goin…g which is going to be awaited by the schedule render. Before this fix \`querySelectorAll\` could return an empty nodes list as the dates were not rendered yet.
> 
> Note next shouldn't have this effect here, so it's either a false positive or another side effect we were not expecting.

---

<div class="post-metadata">

**Author:** ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)\
**Post date:** [2025年一月9日 08:48 UTC](https://meta.discourse.org/t/upgraded-pre-existing-calendar-events-shifted-from-local-time-to-utc/343653/14 "2025-01-09T08:48:10Z")

</div>

此主题在上次回复后 3 天自动关闭。不允许新的回复。
