Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dayjs.duration().humanize() international #1007

Closed
zf1998 opened this issue Aug 15, 2020 · 2 comments · Fixed by #1008
Closed

dayjs.duration().humanize() international #1007

zf1998 opened this issue Aug 15, 2020 · 2 comments · Fixed by #1008
Labels

Comments

@zf1998
Copy link

zf1998 commented Aug 15, 2020

My code:

import dayjs from 'dayjs'
import duration from 'dayjs/plugin/duration'
import relativeTime from 'dayjs/plugin/relativeTime'
import localeData from 'dayjs/plugin/localeData'

import 'dayjs/locale/zh-cn'

dayjs.extend(duration)
dayjs.extend(relativeTime)
dayjs.extend(localeData)

dayjs.locale('zh-cn')

dayjs.duration(24 * 60 * 60 * 1000).humanize() // return ' a day'

How to make "humanize()" return a Chinese string? I need your help, thanks.

@iamkun
Copy link
Owner

iamkun commented Aug 16, 2020

Please use

dayjs.duration(24 * 60 * 60 * 1000).locale('zh-cn').humanize()

in the current version.

Global locale duration support dayjs.locale('zh-cn') will be added in the next version.

iamkun pushed a commit that referenced this issue Aug 20, 2020
## [1.8.34](v1.8.33...v1.8.34) (2020-08-20)

### Bug Fixes

* Fix Timezone plugin to preserve milliseconds while changing timezone ([#1003](#1003)) ([5f446ed](5f446ed)), closes [#1002](#1002)
* support parsing unlimited decimals of millisecond ([#1010](#1010)) ([d1bdd36](d1bdd36)), closes [#544](#544)
* update Duration plugin to support global locale ([#1008](#1008)) ([1c49c83](1c49c83)), closes [#1007](#1007)
@iamkun
Copy link
Owner

iamkun commented Aug 20, 2020

🎉 This issue has been resolved in version 1.8.34 🎉

The release is available on:

Your semantic-release bot 📦🚀

andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this issue May 10, 2022
## [1.8.34](iamkun/dayjs@v1.8.33...v1.8.34) (2020-08-20)

### Bug Fixes

* Fix Timezone plugin to preserve milliseconds while changing timezone ([#1003](iamkun/dayjs#1003)) ([5f446ed](iamkun/dayjs@5f446ed)), closes [#1002](iamkun/dayjs#1002)
* support parsing unlimited decimals of millisecond ([#1010](iamkun/dayjs#1010)) ([d1bdd36](iamkun/dayjs@d1bdd36)), closes [#544](iamkun/dayjs#544)
* update Duration plugin to support global locale ([#1008](iamkun/dayjs#1008)) ([1c49c83](iamkun/dayjs@1c49c83)), closes [#1007](iamkun/dayjs#1007)
andrewhood125ruhuc added a commit to andrewhood125ruhuc/SidRH2 that referenced this issue May 10, 2022
## [1.8.34](iamkun/dayjs@v1.8.33...v1.8.34) (2020-08-20)

### Bug Fixes

* Fix Timezone plugin to preserve milliseconds while changing timezone ([#1003](iamkun/dayjs#1003)) ([5f446ed](iamkun/dayjs@5f446ed)), closes [#1002](iamkun/dayjs#1002)
* support parsing unlimited decimals of millisecond ([#1010](iamkun/dayjs#1010)) ([d1bdd36](iamkun/dayjs@d1bdd36)), closes [#544](iamkun/dayjs#544)
* update Duration plugin to support global locale ([#1008](iamkun/dayjs#1008)) ([1c49c83](iamkun/dayjs@1c49c83)), closes [#1007](iamkun/dayjs#1007)
splashwizard pushed a commit to splashwizard/tracking-time that referenced this issue Oct 21, 2024
## [1.8.34](iamkun/dayjs@v1.8.33...v1.8.34) (2020-08-20)

### Bug Fixes

* Fix Timezone plugin to preserve milliseconds while changing timezone ([#1003](iamkun/dayjs#1003)) ([5f446ed](iamkun/dayjs@5f446ed)), closes [#1002](iamkun/dayjs#1002)
* support parsing unlimited decimals of millisecond ([#1010](iamkun/dayjs#1010)) ([d1bdd36](iamkun/dayjs@d1bdd36)), closes [#544](iamkun/dayjs#544)
* update Duration plugin to support global locale ([#1008](iamkun/dayjs#1008)) ([1c49c83](iamkun/dayjs@1c49c83)), closes [#1007](iamkun/dayjs#1007)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants