nextcloud-libraries / nextcloud-libraries/nextcloud-vue

Respecting users language when formatting dates

Open
#8,930 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

design discussion enhancement feature: datepicker l10n
Dominant language
Vue
Stars
246
Forks
99
Avg merge
1d 20h
Merged PRs (30d)
103

Description

When formatting dates the users locale setting is used but not the language.

Proposed change

Keep using users locale to determine date formats.
But use the users language for translating the words (month and weekday names) in the formatted date.

Example
  • Given
    • User language "German"
    • User locale "English"
    • Date '2026-03-02'
  • When
  • Formatting date equivalent to Intl.DateTimeFormat(.., { dateStyle: 'full'})
  • Then (currently)
    • Resulted is Monday, March 2, 2026
  • Then (with proposed change)
    • Resulted is Montag, März 2, 2026

Note the result is not 'Montag, 2. März 2026' which would be the German format for { dateStyle: 'full'}.
Montag, März 2, 2026 is still the English format but with German words.

Affect components
  • NcDateTimePicker
    • uses date-fns for formatting
  • NcDateTime
    • use useFormatTime
      • uses Intl.DateTime
Background

Review comment https://github.com/nextcloud-libraries/nextcloud-vue/pull/8644#issuecomment-5103248212

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the NcDateTimePicker component, which uses date-fns, and NcDateTime through useFormatTime, which uses Intl.DateTime. Trace how each receives the user's locale and language, then verify both preserve locale-based date formatting while translating month and weekday names with the language. Use the German-language, English-locale example as the completion check.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend, internationalization, localization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.