question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dayjs localization

See original GitHub issue

Is your feature request related to a problem? Please describe.

material-ui-pickers documentation mentions date-fns & moment, but nothing about dayjs.

Is it supported, and how to use it?

Configuring dayjs locale globaly before initialization partially works, but formats and weekStart (Sunday or Monday are still default one: english).

  dayjs.extend(utc, {});
  dayjs.locale('fr'); // default locale
  <MuiPickersUtilsProvider utils={DayjsUtils} locale="fr">

image

Describe the solution you’d like

Official support & documentation for dayjs localization would be a must!

Additional context

Not sure if it is related but last date-io version mention support for dayjs localization: https://github.com/dmtrKovalenko/date-io/pull/39

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
VolkerSchiewecommented, Oct 1, 2020

In case someone is finding this issue because of the missing documentation:

just import the local from dayjs and set the local globally on dayjs:

import "dayjs/locale/de"

dayjs.locale("de")

dayjs docs

1reaction
Studio384commented, Jul 2, 2019

I’d like an update on this as well. Setting the local shifts the numbers for the days correctly, but the labels keep starting with Sunday instead of Monday.

Read more comments on GitHub >

github_iconTop Results From Across the Web

LocalizedFormat
LocalizedFormat extends `dayjs().format` API to supply localized format options.
Read more >
How to get the locale format? #680 - iamkun/dayjs - GitHub
var dayjs = require("dayjs") var LocalizedFormat = require( 'dayjs/plugin/localizedFormat') var localeData = require( ...
Read more >
The Complete Guide to Day.js - Mirza Leka - Medium
To run Day.js, simply type dayjs() and this will generate you a ... are a few localized format tokens that can be used...
Read more >
dayjs localizedFormat not showing special characters
Now I want to migrate from moment to dayjs so I created a new function that should create me localized date strings like...
Read more >
dayjs-example - CodeSandbox
Activating extension 'vscode.typescript-language-features' failed: Could not find bundled tsserver.js.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found