leeoniya / leeoniya/uPlot

Time format depending on the locale (bcp47)

Open
#474 9 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

discussion question
Dominant language
JavaScript
Stars
10.5k
Forks
463
PR merge metrics
No merged PRs in 30d

Description

Hi,
How to display time in locale specific format (bcp47 language tag)?

const event=new Date();
const options={timeZone:'UTC',year:'numeric',month:'numeric',day:'numeric',hour:'numeric',minute:'numeric',second:'numeric'};

console.log(event.toLocaleDateString('ko-KR', options)); // → "2021. 3. 20. 오후 3:40:17"
console.log(event.toLocaleDateString('en-GB', options)); // → "20/03/2021, 15:40:17"
console.log(event.toLocaleDateString('en-US', options)); // → "3/20/2021, 3:40:17 PM"
console.log(event.toLocaleDateString('de-DE', options)); // → "20.3.2021, 15:40:17"
console.log(event.toLocaleDateString('ru-RU', options)); // → "20.03.2021, 15:40:17"

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toLocaleDateString

Thanks.

Contributor guide

No contributing guide indexed for this repository

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

The issue provides locale-specific JavaScript Date formatting examples but names no uPlot files, tests, or entry points. Start by locating the chart's time-axis formatting behavior, then define the supported locale input and expected output before implementing and testing the proposed behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
data-visualization
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.