Skip to content

Improve date formatting by configuring toLocaleString with locale parameters #21

@coderabbitai

Description

@coderabbitai

Description

Currently, the BIRTH_DAY_FORMAT function in all translation files uses toLocaleString() without any locale parameters, which relies on browser defaults.

Details

  • All language files (including the newly added Hebrew translation) use birthDay.toLocaleString() without parameters
  • For proper localization, toLocaleString should include appropriate locale and formatting options
  • This would provide consistent and culturally appropriate date formatting across different languages

Example improvement

Instead of:

export const BIRTH_DAY_FORMAT = (birthDay: Temporal.PlainDate) =>
  `Birthday: ${birthDay.toLocaleString()}`;

Consider:

export const BIRTH_DAY_FORMAT = (birthDay: Temporal.PlainDate) =>
  `Birthday: ${birthDay.toLocaleString('en', { dateStyle: 'long' })}`;

With each translation file using its respective locale code.

Related PR

This issue was identified during the review of #15 (Add Hebrew)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions