Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change material ui datepicker language and default timezone?

How can I change the language of a Material-UI date picker? It doesn't seem to fully work for the whole date picker.

What my current date picker looks like:

Current datepicker

like image 274
stack qtion Avatar asked Aug 09 '18 21:08

stack qtion


People also ask

How can I change the language of a material-UI date picker?

How can I change the language of a Material-UI date picker? It doesn't seem to fully work for the whole date picker. Importing MomentUtils might do the trick. Change locale to your language (example is spanish) Another solution is to use date-fns in addition to the @Shikyo solution: :

Does datepicker work in other timezones?

In other words, if I give it a Date object, is it going to show me the date in the local timezone, or can I force it to show the date in some other timezone? DatePicker uses the JavaScript Date object as input and output. It works in local timezone.

How to use material UI Pickers with datepicker?

For using the Datepicker component, we also need to install the Material UI Pickers package Install the date-io package to perform various basic date operations Note: For material-ui-pickers v3 use v1.x version of @date-io adapters. There are a number of UI components provided by Material UI package modules.

Does material-UI/datepicker support global clock functionality?

Recently we have implemented a globalization functionality in app, While developing global clock functionalities We have faced an issue with material-ui/DatePicker. In a search form I tried to create a date picker with user-specified timezone using material-ui/DatePicker and moment-timezone packages, and I passed the input date like this:


1 Answers

Another solution is to use date-fns in addition to the @Shikyo solution: :

import DateFnsUtils from "@date-io/date-fns";
import { fr } from "date-fns/locale";

<MuiPickersUtilsProvider locale={fr} utils={DateFnsUtils}>
...
</MuiPickersUtilsProvider>
like image 82
nemoxi Avatar answered Nov 10 '22 13:11

nemoxi