Skip to content

Conversation

@rodrigost23
Copy link
Contributor

Description

Adds locale-aware dates, fixes #470.

Demo

image image

Checklist

  • I have read CONTRIBUTING.md in its entirety
  • I have performed a self-review of my own code
  • I have added unit tests to cover my changes
  • The last commit successfully passed pre-commit checks
  • Any AI code was thoroughly reviewed by me

Comment on lines +41 to +44
return format(date, 'MMM dd', {
locale: getSupportedLanguages().find((lang) => lang.code === todayTranslation.usedLng)
?.dateLocale,
});
Copy link
Collaborator

@krokosik krokosik Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we could just use new Intl.DateTimeFormat(todayTranslation.usedLng, {day: '2-digit', month: 'short'}).format(date)?

Copy link
Contributor Author

@rodrigost23 rodrigost23 Nov 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried that, but this Intl API is kind of weird. At least for pt-BR and pt-PT, the results are awful, so I'm not sure what other languages would look like to native speakers.

pt-PT:

I don't know why it would format "short" month to "11" (we have "numeric" for that, right?). 

pt-BR:

The word "de" here is just a preposition that we can totally ignore when we want it to be shorter.


Maybe we could have a specific function only for this expense date prefix and use the Intl for other places, which would probably make this look better:
 

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dates are not localized

2 participants