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

Duration format localization #2700

Open
kgni opened this issue Jul 25, 2024 · 0 comments
Open

Duration format localization #2700

kgni opened this issue Jul 25, 2024 · 0 comments

Comments

@kgni
Copy link

kgni commented Jul 25, 2024

Hi there.

I'm trying to implement localization for durations in the format: 0d 0h 0m 0s whenever I pass in x-amount of seconds.

I currently just have a function like this, and it works fine for english, but the units are not localized.

 formatSeconds(seconds: number) {
    return dayjs.duration(seconds, 'seconds').format('D[d] H[h] M[m] s[s]');
  }

I thought I could change this behaviour by using the updateLocale plugin, but it doesn't seem like it from the documentation (I might be wrong).

Is it possible to implement localization for this with the dayjs library as of now, or do I have to implement something custom myself?

Thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant