iamkun / iamkun/dayjs

Dynamic switching of local time format issues

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

Description

**Describe**
When i18n dynamically switch need to go to modify the corresponding dayjs time format, `dayjs.locale()` has changed, but the formatted time is not responsive, I guess this is related to vue reactive?

**Expected**
As the example shows, when the locale changes, go to dynamically modify the display format of today.

**Partial Code**
```vue
const today = ref(dayjs().format('dddd, MMMM D'));
watch(locale, (val) => {
dayjs.locale(val);
});
```

[Example link](https://vue-d5qgkm.stackblitz.io)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.