Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!