You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
w2p_Utilities_Date::format() ignores %: literal letters are replaced and most codes are unsupported #519
w2p_Utilities_Date::format() (classes/w2p/Utilities/Date.class.php) splits the format string into single characters and replaces each one it recognises, ignoring %:
Literal letters are replaced. Any Y, d, m, H, I, S, M, p, b, B, A, T or U in a format string becomes a date part, whether or not it follows %.
Unsupported codes come out as the bare letter.%w, %a, %e, %y, %j, %D and the other strftime/PEAR codes the class used to inherit are not handled.
For 2026-10-21 14:05:09 (a Wednesday):
Format
Output
%w
w
%a
a
%e / %y / %j / %D
e / y / j / D
%d de %B de %Y
21 21e October 21e 2026
Today: %A
14:05:09o21ay: Wednesday
Effects found so far:
w2p_Output_MonthCalendar compared cells with format('%Y%m%d%w'), so today was never highlighted (worked around locally by comparing %Y%m%d).
getBeginWeek() / getEndWeek() use Format('%w'); see the separate issue.
Any user date/time format preference (SHDATEFORMAT, TIMEFORMAT) that contains other codes or literal text is mangled.
Fix: parse %x pairs (copy anything else through unchanged), and support the codes the code base and the date-format preferences use. A test per supported code, plus literal text, would pin it down. Worth auditing the stored SHDATEFORMAT/TIMEFORMAT choices and every format()/Format() call for codes that aren't supported today.
Activity
w2p_Utilities_Date::format(): parse %-codes and copy other text
getBeginWeek()/getEndWeek(): return the ISO week of the date