esnet / esnet/react-timeseries-charts

Internationalization?

Open
#458 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
876
Forks
279
PR merge metrics
No merged PRs in 30d

Description

Is there a way to change local time format?

I am working on a project using this library, and I want to change the time format to a local date format like this:
![image](https://user-images.githubusercontent.com/38247819/98083271-137ff980-1eb5-11eb-970e-01d71500de32.png)

I cannot find a convenient way to do this in this library.
After searching the source code, I realized this library used the `d3-time-format` library for time formatting. So I import this library and use its `timeFormatDefaultLocale` method to set up local time format in a global procedure.

```
import { timeFormatDefaultLocale } from 'd3-time-format';

timeFormatDefaultLocale({
// content of JSON file from https://github.com/d3/d3-time-format/tree/master/locale
});
```

I feel this is a bit hacky. I am wondering if there is a better way to do this? Appreciate!

Contributor guide

Open the contributing guide

Research direction

Review the chart's existing time-formatting path and the d3-time-format integration described in the issue. Determine whether library-level locale configuration is feasible, then verify that labels render in the requested local date format; the issue provides no named file or test.

Written by the indexing model from the issue text.

Assessment

Tech stack
d3, javascript, react
Domain
frontend, localization
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.