# 🌍 新日历功能：显示本地时间

**URL:** https://meta.discourse.org/t/new-calendar-feature-show-local-time/368608
**Category:** Announcements
**Tags:** events
**Created:** [2025年六月2日 20:54 UTC](https://meta.discourse.org/t/new-calendar-feature-show-local-time/368608 "2025-06-02T20:54:30Z")
**Posts on this page:** 1
**Showing post:** 25

<div class="post-metadata">

### Author: ![yuriy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/yuriy/32/498097_2.png) [@yuriy](https://meta.discourse.org/u/yuriy)
#### Post date: [2025年六月23日 13:46 UTC](https://meta.discourse.org/t/new-calendar-feature-show-local-time/368608/25 "2025-06-23T13:46:34Z")

</div>

我有两个相关的 PR：

> <https://github.com/discourse/discourse-calendar/pull/745>
>
> This PR overhauls the way event dates are rendered by applying context-aware for…matting rules:
> \* Single-day events only show times when appropriate, hiding “12:00 AM” for events without \`endDate\`.
> \* Multi-day ranges omit redundant parts (e.g. for the current year) and include weekday/month/day when needed.
> 
> \### Tests added
> \* Weekday-only ranges (e.g. “Friday → Monday”)
> \* Same-week and same-month spans (omitting year)
> \* Cross-month and cross-year spans (including year where needed)
> \* \`Today/Yesterday/Tomorrow\` labels with time ranges
> \* Same-day events showing only time ￼
> 
> \### Impact
> \* Improves readability of event dates across the app
> \* Reduces visual noise by hiding redundant date/time fragments
> \* Ensures consistency with user expectations around relative dates
> 
> \### Things to clarify
> 
> \* Relative labels (\`Yesterday, Today, Tomorrow\`) replace literal dates for nearby days.
> \* Timezones are only shown when \`showLocalTime\` is toggled.
> 
> \### Discussion
> 
> https://meta.discourse.org/t/new-calendar-feature-show-local-time/368608/

> <https://github.com/discourse/discourse/pull/33291>

* * *

@nat，我把你拉进来，因为你几年前做过这个功能：

> <https://github.com/discourse/discourse/pull/18500>
>
> Essentially, introducing this change.
> 
> Saturday at 2:50 PM -\> Saturday at 4:38… PM 
> becomes 
> Saturday at 2:50 PM -\> 4:38 PM (Singapore)
> 
> Also, the displayed dates are shortened when the standalone date
> is within two days. So despite the 'from' and 'to' date being the 
> same day, it may show 'Saturday' for 'from', and the specific date 
> for the 'to'. This corrects the behaviour. So if the current date and 
> time is Thursday 5PM, the 'from' date below is within 2 days, but
> the 'to' date is not.
> 
> Saturday at 2:50 PM -\> 8 October 2022 at 9:38 PM 
> becomes
> Saturday at 2:50 PM -\> 9:38 PM

> <https://github.com/discourse/discourse/commit/1631394826e03073f99caa990811f261590d3257>

1. 在什么情况下，我们应该在 `from/to` 日期/时间后显示括号中的时区名称？

2. 显示的期望是什么：星期几名称 `Monday...Sunday` 还是 `Yesterday/Today/Tomorrow`？

---

_[View the full topic](https://meta.discourse.org/t/new-calendar-feature-show-local-time/368608)._
