# Safari 上的事件日历“upcoming events”面板日期显示异常

**URL:** <https://meta.discourse.org/t/invalid-date-showing-in-right-sidebar-blocks-component-for-upcoming-events-panel-on-safari/371617>\
**Category:** Bug\
**Tags:** events, right-sidebar-blocks, fixed\
**Created:** [2025年六月25日 09:34 UTC](https://meta.discourse.org/t/invalid-date-showing-in-right-sidebar-blocks-component-for-upcoming-events-panel-on-safari/371617 "2025-06-25T09:34:29Z")\
**Posts on this page:** 1\
**Showing post:** 18

<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年六月25日 20:45 UTC](https://meta.discourse.org/t/invalid-date-showing-in-right-sidebar-blocks-component-for-upcoming-events-panel-on-safari/371617/18 "2025-06-25T20:45:39Z")

</div>

好的，这应该可以解决问题：

> <https://github.com/discourse/discourse-calendar/pull/756>
>
> We were building the list of events by using the non padded day as key, eg:
> 
> \`…\`\`
> { 3: { ... }, 16: { ... } }
> \`\`\`
> 
> Which we would then use to construct a date and would end up doing something like:
> 
> \`\`\`
> moment("2025-07-3").format()
> \`\`\`
> 
> It was working in most browsers, but safari was not accepting it and would display an \`invalid date\` error.
> 
> The fix is using a padded day as key that will ensure consistent behavior:
> 
> \`\`\`
> { "03": { ... }, "16": { ... } }
> \`\`\`
> 
> No test as it's browser specific behavior.

---

_[View the full topic](https://meta.discourse.org/t/invalid-date-showing-in-right-sidebar-blocks-component-for-upcoming-events-panel-on-safari/371617)._
