Skip to content

[BUG]: formatDate breaks quoted literals and EEE since date-fns was removed #2937

Open

Description

@jayhemnani9910
  • 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" renders Feb 2 'PMt' 3:17 PM: the a inside 'at' is read as the AM/PM token and the quotes are kept.
  • "EEE, MMM d" renders MonMonMon, Feb 2: EEE is matched as three E tokens.

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") shows Monday, Dec 15 'AMt' 7:30 AM
  • specification/v0_9_1/catalogs/basic/examples/30_live-invitation-builder.json:169 ("EEEE, MMMM d, yyyy 'at' h:mm a") shows Tuesday, 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.

Activity

  1. jayhemnani9910 commented on Oct 1, 2026

    @jayhemnani9910
    Author

    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, and EE/EEE give the abbreviated weekday, in both engines. With the two example patterns and 2025-12-15T07:30:00Z, both engines now give Monday, Dec 15 at 7:30 AM and Monday, December 15, 2025 at 7:30 AM. New unit tests in basic_functions.test.ts and test_functions.py (v0_9 and v1_0) fail on main; web_core yarn test, uv run pytest, uv run mypy ., prettier and pyink pass. Happy to open a PR.

  2. added
    status: needs-triageauto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs
    on Oct 1, 2026
  3. added
    P1This is a priority. Team is actively working on it, or will be soon.
    P2The team intends to work on this in the near future, or at a lower priority.
    and removed
    P1This is a priority. Team is actively working on it, or will be soon.
    on Oct 22, 2026
  4. moved this from Todo to In Progress in A2UIon Oct 30, 2026
  5. karolkulesza commented on Oct 30, 2026

    @karolkulesza
    Contributor

    Opened #3787 for this: shared functions.yaml cases for quoted literals, '' and EEE, and the tokenizer fix in web_core, Python (v0.9 and v1.0) and Dart. Swift already handled them through DateFormatter. Thanks for the clear repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2The team intends to work on this in the near future, or at a lower priority.status: first-line-handledstatus: needs-triageauto-managed: https://github.com/a2ui-project/a2ui/blob/main/scripts/triage.mjs

    Type

    No type

    Projects

    • Status
      In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions