#3372·Carbon

isoFormat(): first character after an L/l/LT macro expansion is replaced by the macro letter

Author: kamthornCreated Sep 30, 2026Updated Sep 30, 2026

In isoFormat(), when a macro (L…LLLL, l…llll, LT, LTS) is expanded, $char still holds the macro letter. If the expanded format starts with literal text, an escape ([…], \) or another macro, that first character is output as L (or l).

php
Carbon::parse('2026-09-30 14:05')->locale('th')->isoFormat('LLLL');
// actual:   "Lันพุธที่ 30 กันยายน 2026 เวลา 14:05"
// expected: "วันพุธที่ 30 กันยายน 2026 เวลา 14:05"

A scan of all locales on master found 25 affected formats in 11 locales:

Locale Formats Actual → expected (first chars)
th, th_TH LLLL, llll Lันพุธ… → วันพุธ…
lo, lo_LA LLLL, llll Lັນພຸດ… → ວັນພຸດ…
dz, dz_BT L, l, calendar.sameElse Lསྱི་ལོ… → པསྱི་ལོ…
bo_IN LLL, lll Lྤྱི་ལོ… → སྤྱི་ལོ…
ps, ps_AF LLL, lll L 2026 د… → د 2026 د…
nnh LLL, lll the format starts with [, so the escape is lost too
ne_IN L, l, calendar.sameElse the format starts with yy, which isn't a token (see #3371)

A fix is proposed in #3369.