Repository navigation
[BUG]: formatDate breaks quoted literals and EEE since date-fns was removed #2937
Description
- I have searched the existing issues to make sure this bug has not already been reported.
Describe the Bug
formatDate is specified as taking a Unicode TR35 date pattern. Since web_core 0.12.0 dropped date-fns, the token regex in typescript/web_core/src/common/basic_functions.ts:294 does not know TR35 quoted literals and has no EE/EEE tokens:
"MMM d 'at' h:mm a"rendersFeb 2 'PMt' 3:17 PM: theainside'at'is read as the AM/PM token and the quotes are kept."EEE, MMM d"rendersMonMonMon, Feb 2:EEEis matched as threeEtokens.
Two of the v0.9.1 basic catalog examples use a quoted literal and render wrong in the published @a2ui/react 0.12.0:
specification/v0_9_1/catalogs/basic/examples/16_workout-summary.json:136("EEEE, MMM d 'at' h:mm a") showsMonday, Dec 15 'AMt' 7:30 AMspecification/v0_9_1/catalogs/basic/examples/30_live-invitation-builder.json:169("EEEE, MMMM d, yyyy 'at' h:mm a") showsTuesday, July 15, 2025 'PMt' 7:00 PM
@a2ui/web_core 0.11.0 (date-fns) renders both correctly. The Python a2ui_core uses the same regex (basic_catalog/v0_9/function_impls.py and v1_0/function_impls.py), so it has the same output. Swift uses DateFormatter and is fine.
Steps to Reproduce
import {FormatDateImplementation} from '@a2ui/web_core/v0_9/basic_catalog';
const value = '2026-02-02T15:17:09Z';
for (const format of ["MMM d 'at' h:mm a", 'EEE, MMM d', "h 'o''clock'"]) {
console.log(FormatDateImplementation.execute({value, format}));
}Expected Behavior
Feb 2 at 3:17 PM
Mon, Feb 2
3 o'clock
Actual:
Feb 2 'PMt' 3:17 PM
MonMonMon, Feb 2
3 'o''clock'
Environment Details
- OS: Ubuntu
- Browser/Platform: Node.js 22; Python 3.13
- SDK/Package Name & Version: @a2ui/web_core 0.12.0, @a2ui/react 0.12.0, a2ui-core (main at 102ec1a)
- Protocol Version: v0.9.1
- Agent Framework & LLM Model: n/a
Additional Context
Happy to send a PR for both engines: match a quoted literal as one token and emit its text, map '' to an apostrophe, and give EE/EEE the abbreviated weekday. The shared conformance/core/functions.yaml has one formatDate case; quoted-literal cases could go there too once the other SDKs are checked against it.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Progress
Activity
jayhemnani9910 commentedon Oct 1, 2026
A fix for web_core and Python a2ui_core is on this branch: main...jayhemnani9910:A2UI:fix/format-date-tr35-literals
Quoted literals are matched as one token and emitted as text,
''becomes an apostrophe, andEE/EEEgive the abbreviated weekday, in both engines. With the two example patterns and2025-12-15T07:30:00Z, both engines now giveMonday, Dec 15 at 7:30 AMandMonday, December 15, 2025 at 7:30 AM. New unit tests inbasic_functions.test.tsandtest_functions.py(v0_9 and v1_0) fail on main; web_coreyarn test,uv run pytest,uv run mypy ., prettier and pyink pass. Happy to open a PR.karolkulesza commentedon Oct 30, 2026
Opened #3787 for this: shared
functions.yamlcases for quoted literals,''andEEE, and the tokenizer fix in web_core, Python (v0.9 and v1.0) and Dart. Swift already handled them throughDateFormatter. Thanks for the clear repro.