Comments (5)
@acidjazz
Thanks for answering.
nuxt.config.ts
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
modules: ['dayjs-nuxt'],
dayjs: {
locales: ['ko', 'en'],
plugins: ['relativeTime', 'utc', 'timezone'],
defaultLocale: 'ko',
defaultTimezone: 'Asia/Seoul',
},
});
I added this code in nuxt.config.ts
defaultLocale: 'ko',
Isn't it for setting defaultLocale?
If it isn't, could you make it correct?
Anyway I will try same thing with v2.1.7 and leave comment ASAP
Updated.
defaultLocale looks working well in 2.1.7 version.
But I want to make what I understand clear.
If I didn't understand correctly, make me clear.
It's only possible setting global default locale in nuxt.config.
If I want to make locale updated with local browser language setting, I need to make composable to support it.
Is that right?
Then why don't it support update locale automatically based on user's locale based on might be browser?
It can be supported by optional.
from dayjs.
https://stackblitz.com/edit/nuxt-starter-rstvii?file=app.vue
Look, I set defaultLocale as ko But fromNow doesn't return time with ko locale.
And it also doesn't reflect browser locale setting.
You are only setting the locale for that one line in the component, you need to set it in your nuxt config if it you want it global, or have a composable return it w/ that locale
from dayjs.
@acidjazz
Thanks for quick response!
I am not sure what I unserstand correctly.
-
"you need to set it in your nuxt config if it you want it global"
-> I set it as "ko" in nuxt.config.ts , you can check it in the link. So I expect
This codeuseDayjs()('2023-01-01').fromNow()
returns "10 달 전"
But it returns 10 months ago. It isn't ko locale.. Isn't it? -
"have a composable return it w/ that locale"
I am not sure how I can make code as you said.
from dayjs.
@quroom i did not see you set it up in your nuxt config, looking into this now..
from dayjs.
fixed in https://github.com/fumeapp/dayjs/releases/tag/v2.1.7
from dayjs.
Related Issues (19)
- Duplicated line HOT 1
- README.md content issue HOT 2
- weekStart
- feature request: allow external plugins
- dayjs() Type error occured HOT 3
- useDayjs missing from export HOT 6
- Error 500 when plugin extend HOT 8
- Nuxt 2 support HOT 1
- updateLocale is not defined HOT 1
- Not compatible with String + Format plugin HOT 4
- useDayjs composable return any HOT 2
- Typescript error: Expected 0-1 arguments, but got 2 with custop parse format HOT 1
- ts error HOT 2
- relativeTime thresholds options? HOT 11
- useDayjs() returns an any HOT 2
- Typescript support HOT 2
- Doesn't work in server directory HOT 3
- Cannot build in prod with Nuxt typescript typecheck option enabled HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dayjs.