# 事件未创建/日期解析错误

**URL:** <https://meta.discourse.org/t/events-not-being-created-date-misparsed/381128>\
**Category:** Bug\
**Tags:** events\
**Created:** [2025年九月1日 10:18 UTC](https://meta.discourse.org/t/events-not-being-created-date-misparsed/381128 "2025-09-01T10:18:33Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)\
**Post date:** [2025年九月1日 10:18 UTC](https://meta.discourse.org/t/events-not-being-created-date-misparsed/381128/1 "2025-09-01T10:18:34Z")

</div>

某些计算机上会出现此情况，而另一些则不会。  
它们被设置为“Europe/Berlin”时区，日期显示为 DD.MM.YYYY。

这似乎是由 Discourse 显示日期但随后错误解析该日期引起的。  
当创建事件弹出窗口打开时，它会预先填充为 26.08.2025 格式的日期（8 月 26 日）。

在某些情况下，事件未被创建：一旦关闭事件模态框，它就不会在编辑器中插入事件。浏览器控制台中未显示任何错误。

在其他情况下，日期会被错误解析。例如，01.09.2025（今天）会变成 1 月 9 日。但昨天 31.08.2025 却变成了无效日期。

该插件具有以下代码：

```plaintext
  @tracked startsAt = moment(this.event.startsAt).tz(
    this.event.timezone || "UTC"
  );

```

并且存在一段代码会在解析失败时默默地什么都不做（也许应该显示错误？用户甚至无法清除 startsAt，所以这只会在解析失败时发生）。

```plaintext
  @action
  createEvent() {
    if (!this.startsAt) {
      this.args.closeModal();
      return;
    }

```

所以基本上：

- Discourse 显示今天的日期
- 创建事件时，它无法正确解析相同的日期。

---

_[View the full topic](https://meta.discourse.org/t/events-not-being-created-date-misparsed/381128)._
