Locale-dependent date formatting causes inconsistency #8661

Open
opened 2026-02-16 18:10:31 -05:00 by yindo · 1 comment
Owner

Originally created by @scarf005 on GitHub (Feb 5, 2026).

Originally assigned to: @rekram1-node on GitHub.

Problem

The codebase currently uses locale-dependent date formatting via toLocaleDateString() without specifying a locale, leading to inconsistent date representations across different systems and regions.

Examples of Inconsistency

  • US locale: 2/4/2026 (MM/DD/YYYY)
  • European locale: 4/2/2026 (DD/MM/YYYY)
  • ISO 8601: 2026-02-04 (YYYY-MM-DD)

This ambiguity makes dates unclear and problematic for:

  • Data exchange and API responses
  • Log parsing and analysis
  • Sorting and comparing dates
  • International users

Expected Behavior

Dates should be formatted consistently using the ISO 8601 standard (YYYY-MM-DD) which is:

  • Internationally recognized: Removes ambiguity between US and European formats
  • Lexicographically sortable: YYYY-MM-DD sorts correctly as strings
  • Unambiguous: Clear year-month-day order
  • Machine-friendly: Better for data interchange

Proposed Solution

Update Locale.datetime() in packages/opencode/src/util/locale.ts to use the en-CA locale for toLocaleDateString(), which outputs dates in YYYY-MM-DD format (ISO 8601).

Impact

  • Improves consistency across the application
  • Better user experience for international users
  • Safer date handling in APIs and data storage
  • Easier date parsing and manipulation
Originally created by @scarf005 on GitHub (Feb 5, 2026). Originally assigned to: @rekram1-node on GitHub. ## Problem The codebase currently uses locale-dependent date formatting via `toLocaleDateString()` without specifying a locale, leading to inconsistent date representations across different systems and regions. ## Examples of Inconsistency - **US locale**: 2/4/2026 (MM/DD/YYYY) - **European locale**: 4/2/2026 (DD/MM/YYYY) - **ISO 8601**: 2026-02-04 (YYYY-MM-DD) This ambiguity makes dates unclear and problematic for: - Data exchange and API responses - Log parsing and analysis - Sorting and comparing dates - International users ## Expected Behavior Dates should be formatted consistently using the ISO 8601 standard (YYYY-MM-DD) which is: - **Internationally recognized**: Removes ambiguity between US and European formats - **Lexicographically sortable**: YYYY-MM-DD sorts correctly as strings - **Unambiguous**: Clear year-month-day order - **Machine-friendly**: Better for data interchange ## Proposed Solution Update `Locale.datetime()` in `packages/opencode/src/util/locale.ts` to use the `en-CA` locale for `toLocaleDateString()`, which outputs dates in YYYY-MM-DD format (ISO 8601). ## Impact - Improves consistency across the application - Better user experience for international users - Safer date handling in APIs and data storage - Easier date parsing and manipulation
Author
Owner

@github-actions[bot] commented on GitHub (Feb 5, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #12398: feat: standardize date format to ISO 8601

Both issues address the exact same problem of locale-dependent date formatting and propose the same solution (using en-CA locale for ISO 8601 format output). Feel free to ignore if this addresses a different aspect.

@github-actions[bot] commented on GitHub (Feb 5, 2026): This issue might be a duplicate of existing issues. Please check: - #12398: feat: standardize date format to ISO 8601 Both issues address the exact same problem of locale-dependent date formatting and propose the same solution (using en-CA locale for ISO 8601 format output). Feel free to ignore if this addresses a different aspect.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8661