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

216
Views
formatting date into ISO string for `react-admin`

My API needs the date to be in ISO format. I have tried multiple ways to get that in react-admin DateInput component I'm still not able to get the date in that format. Either the input element gets frozen, or invalid date error is thrown or the date is still getting in YYYY-MM-DD format. I'm trying to use parse and format props but the input element gets frozen for some reason.

const dateParser = (v: string) => {
  return new Date(v?.split('T')[0]);
};

const dateFormatter = (v: Date) => {
  if (!(v instanceof Date) || Number.isNaN(v)) return;
  const formatted = v.toISOString();
  return formatted;
};
<DateInput  source="pub_date" format={dateFormatter} defaultValue={new Date()} parse={dateParser} label="Publish Date"  />
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

In my opinion, you have confused functions: format - is used when displaying data, parse - when saving data in a record.

about 4 years ago · Juan Pablo Isaza 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!