iamkun / iamkun/dayjs

dayjs locale config is ignored and it uses automaticly browser locale

Open
#1,783 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
48.7k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**
dayjs locale config is ignored and it uses automaticly browser locale

**Expected behavior**
```js
// config.js
import 'dayjs/locale/fr';
dayjs.locale('fr')
```
in main react page
```js
import './config'
```
and in my component
```js
dayjs(fullStartDate).to(fullEndDate, true);
```
**the language changes to french but when i refrech it comeback english (i think its because the browser locale)**

but when i do this it works as french always
```js
dayjs(fullStartDate).locale('fr').to(fullEndDate, true);
```
how can i config the language clearly without using the locale for each time
**Information**
- Day.js Version 1.10.7
- OS: MacOS monterey
- Browser Chrome last version
- Time zone: (UTC+1)

Contributor guide

Open the contributing guide

Research direction

Start with the config.js import and the main React page described in the report, then reproduce the locale behavior in the component after a browser refresh. Check how the reported Day.js version applies the global locale versus the per-call locale. Done means the French setting persists without adding locale('fr') to each usage.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, localization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.