discourse/plugins/discourse-local-dates/test/javascripts/acceptance
Régis Hanol adbb820c94
FIX: Respect custom date format selection in local dates (#36860)
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"
/>
2025-12-24 16:42:33 +01:00
..
download-calendar-test.js DEV: Move discourse-common/(utils|lib) to discourse/lib (#30733) 2025-01-13 13:02:49 +00:00
download-calendar-with-ics-test.js FIX: "add to calendar" not providing correct ics (#35886) 2025-11-10 14:51:37 +11:00
local-dates-composer-test.js FIX: Respect custom date format selection in local dates (#36860) 2025-12-24 16:42:33 +01:00
local-dates-quoting-test.js FIX: Preserve all date attributes in rich text editor (#36781) 2025-12-24 14:01:52 +01:00