mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-05 03:41:24 +08:00
When inserting a date with a custom format like "LTS", the format was being silently changed to "LL". This happened because the code assumed any format without a time value should fall back to date-only display, but that logic was too broad. Additionally, the markdown preview and rich text editor showed different results for the same date - the preview displayed "Today 3:25 PM" while the rich editor showed "December 24, 2025 3:25 PM". This inconsistency stemmed from calendar mode (relative dates) being always-on in the preview but disabled when a format was specified in the rich editor. The fix narrows the format fallback to only apply when using combined date+time formats (LLL, LLLL) without a time - these are the only cases where falling back to a date-only format actually makes sense. For time-only formats like LTS or already date-only formats like LL, we now preserve the user's choice. Calendar mode now behaves consistently: it's enabled by default for relative dates like "Today", but automatically disabled when a custom format is specified, matching what users expect when they explicitly choose a format. Follow up to https://github.com/discourse/discourse/pull/36781 **BEFORE** <img width="1746" height="1372" alt="2025-12-24 @ 15 44 34" src="https://github.com/user-attachments/assets/9420cff8-424c-4f57-a5c7-8e2ca8885b2c" /> **AFTER** <img width="1746" height="1372" alt="2025-12-24 @ 15 43 07" src="https://github.com/user-attachments/assets/d38a03d6-bb6a-4287-9d44-6cf8a23f6aa9" /> **IT WORKED FINE IN RICH TEXT** <img width="1746" height="1372" alt="2025-12-24 @ 15 44 44" src="https://github.com/user-attachments/assets/7259cc88-57d0-4ab6-98b1-908753e41530" /> |
||
|---|---|---|
| .. | ||
| download-calendar-test.js | ||
| download-calendar-with-ics-test.js | ||
| local-dates-composer-test.js | ||
| local-dates-quoting-test.js | ||