Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

109
Vistas
invalid date format in javascript Date(2022,0,13) format

i am getting

{
  "LeadCreatedDate": "Date(2022,0,13)" // <----- this type of date format
}

image is there any way i can format it in react any kind of help will be great. Thank you in advance.

date format image link

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

If you cannot do anything about the format of the API response, you'll have to manually parse it.

For example, you can use slice() to extract the arguments part, split() them on comma characters to get an array, map() that to numbers and pass them to the Date constructor.

// a function to transform your date values
const parseGSheetDate = (val) =>
  new Date(...val.slice(5, -1).split(",").map(Number));

// your original data
const data = {
  "LeadCreatedDate": "Date(2022,0,13)",
  "FullName": "Maryn Mccabe",
  "FirstName": "Maryn",
  "LastName": "Mccabe",
};

// replace the date fields with their parsed equivalents
const parsed = {
  ...data,
  LeadCreatedDate: parseGSheetDate(data.LeadCreatedDate),
};

console.log(parsed);

about 4 years ago · Juan Pablo Isaza Denunciar

0

To do that, you need to format date before you push data. There is an information, how to do that properly

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda