Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

165
Visualizações
How to set the DateTimePicker default date and time without an offset?

I'm using the MUI DateTimePicker with a custom text input field. The issue I'm having is that when I add a date then reopen the DateTimePicker, the DateTimePicker is set to the wrong default value.

Docs: MUI DateTimePicker

I tried hardcoding the value as shown below. When I reopen the DateTimePicker I get my local date time instead (The picker defaults to 6:30 am instead of 11:30am). Is there a way I can override this behavior? I have the component with the hardcoded dates below.

<div data-testid="date-time-picker">
    <DateTimePicker
      label={label}
      value={"2022-08-01T11:30:00Z"}
      disabled={disabled}
      onChange={() => "2022-08-01T11:30:00Z"}
      renderInput={(params: TextFieldProps) => (
        <TextField
          InputProps={params.InputProps}
          inputProps={{ ...params.inputProps, value }}
          inputRef={params.inputRef}
          setValue={setValue}
          value={value}
          label={label}
          disabled={disabled}
          required={required}
          helptext={helptext}
          errorMsg={errorMsg}
        />
      )}
   />
</div>
<LocalizationProvider dateAdapter={AdapterLuxon} adapterLocale="zu">
 ...
</LocalizationProvider>
about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

My issue was actually caused by not setting the default timezone on the luxon library I was using. To fix it I added the line below and the timezone was fixed.

import { Settings } from "luxon";
...
Settings.defaultZone = "Zulu";
about 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda