Skip to content

[JavaScript / Python] Make a pass to implement missing pre-defined Date format #3976

Closed

Description

@MangelMaxime

Description

It was reported here that "R" format is not supported by Fable, and I suspect some other format are missing too.

https://github.com/microsoft/referencesource/blob/51cf7850defa8a17d815b4700b67116e3fa283c2/mscorlib/system/globalization/datetimeformat.cs#L99-L124

Related information

  • Fable version: 4.24.0
  • Operating system

Activity

  1. github-actions commented on Apr 6, 2026

    @github-actions
    Contributor

    🤖 This is an automated response from Repo Assist.

    Thanks for filing this! I investigated the current state of standard DateTime format specifiers in both the JavaScript/TypeScript and Python runtime libraries.

    Current State

    Both dateToStringWithKind (JS: src/fable-library-ts/Date.ts, Python: src/fable-library-py/fable_library/date.py) only handle a handful of single-character format specifiers in their length === 1 switch:

    Specifier Description JS Python
    d Short date ✅ ✅
    D Long date ✅ ✅
    T Long time ✅ ✅
    t Short time ✅ ✅
    O / o Round-trip (ISO 8601) ✅ ✅
    R / r RFC 1123 ("Thu, 01 Jan 2009 00:00:00 GMT") ❌ ❌
    F Full date/time (long time) ❌ ❌
    f Full date/time (short time) ❌ ❌
    G General date/time (long time) ❌ ❌
    g General date/time (short time) ❌ ❌
    M / m Month/day ❌ ❌
    s Sortable (ISO 8601 without timezone) ❌ ❌
    u Universal sortable ❌ ❌
    U Universal full ❌ ❌
    Y / y Year/month ❌ ❌

    Both targets throw "Unrecognized Date print format" for all unhandled single-character specifiers. The custom-format handler (dateToStringWithCustomFormat) handles multi-character patterns fine.

    Implementation Notes

    • R/r: JS can use date.toUTCString() (already returns RFC 1123 format in modern browsers/Node.js). Python can use date.strftime("%a, %d %b %Y %H:%M:%S GMT") after converting to UTC.
    • s: ISO 8601 without timezone — JS: date.toISOString().replace('Z', '') (adjusted for local); Python: date.strftime("%Y-%m-%dT%H:%M:%S").
    • F/f, G/g, M/m, Y/y: These are locale-dependent in .NET. Since Fable doesn't have full locale support, returning the invariant culture equivalent (fixed English format) would be acceptable, similar to how D, d, T, t are implemented.

    The fix would be straightforward additions to the switch statement in both src/fable-library-ts/Date.ts and src/fable-library-py/fable_library/date.py, plus dateToStringWithOffset for completeness. Since src/fable-library-py/ is on PyPI, care should be taken not to change existing specifier semantics — only add new cases.

    Note

    🔒 Integrity filter blocked 103 items

    The following items were blocked because they don't meet the GitHub integrity level.

    • #4488 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • #4474 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • #4220 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • #4166 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • #4143 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • #4104 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • #4044 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • #4038 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • #3290 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • #2279 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • #2154 list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • [Feature] Array2D operations #1764 list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • Is there a way to get attributes on a union case? #2026 list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • Reflection for classes #2027 list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • StackOverflowException when compiling large match expression #2039 list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • Error doesn't show .fs line number #2052 list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
    • ... and 87 more items

    To allow these resources, lower min-integrity in your GitHub frontmatter:

    tools:
      github:
        min-integrity: approved  # merged | approved | unapproved | none

    Generated by Repo Assist · ● 3.7M · ◷

    To install this agentic workflow, run

    gh aw add githubnext/agentics/workflows/repo-assist.md@346204513ecfa08b81566450d7d599556807389f
    
  2. added a commit that references this issue on Apr 20, 2026
    c2c7697
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions