Skip to content

Add locale option for FOAM_DATE_DAY_NAME_SHORT and FOAM_DATE_DAY_NAME variables #1566

@yahsan2

Description

@yahsan2

Problem

The FOAM_DATE_DAY_NAME_SHORT and FOAM_DATE_DAY_NAME variables use the system's default locale, which causes issues for users who want English day names (Mon, Tue, etc.) but have their OS set to a different language.

Currently, the code uses:

this.foamDate.toLocaleString('default', { weekday: 'short' })

This means users with Japanese, German, or other non-English locales get localized day names (e.g., "月" instead of "Mon").

Related Issues

Why This Matters

The deprecated foam.openDailyNote.filenameFormat setting uses the dateformat library which outputs English day names regardless of locale. Users migrating to the new template-based approach (as recommended) lose this behavior.

For users who have existing daily notes with English day names like:

  • 2023-01-22 (Sun).md
  • 2023-01-23 (Mon).md

The new template system creates files with localized names:

  • 2026-01-05 (月).md

This breaks consistency with existing notes.

Proposed Solution

Add a setting to specify the locale for date variables, for example:

{
  "foam.dateLocale": "en-US"
}

Or add new variables with explicit English locale:

  • FOAM_DATE_DAY_NAME_EN
  • FOAM_DATE_DAY_NAME_SHORT_EN

Environment

  • Foam version: latest
  • OS: macOS (Japanese locale)
  • VS Code version: latest

Workaround

Currently using the deprecated foam.openDailyNote.filenameFormat setting, but this will be removed in future versions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions