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

228
Vistas
TypeError: value.getTime is not a function. (In 'value.getTime()', 'value.getTime' is undefined)

I'm trying to edit the profile data of the user(which has fullName, gender, birthdate) By far when I edit the birthdate and the name, the profile data is edited. But when I change the name only, and save it it shows this error: TypeError: value.getTime is not a function. (In 'value.getTime()', 'value.getTime' is undefined)

 const [date, setDate] = useState(new  Date());


 const onChangeDate = (event, selectedDate) => {
    const currentDate = selectedDate || date;
    setShow(Platform.OS === 'ios');
    setDate(currentDate);
    let tempDate = new Date(currentDate);
    let sDate = tempDate.getDate() + '/' + (tempDate.getMonth() + 1) + '/' + tempDate.getFullYear();
    setIsValidDate(true);
    setDateText(sDate);
  };


  const getUserData = () => {
    axios
      .get(`url/${phone}`)
      .then((response) => {
          setDate(response.data.data[0].birthdate);
      })
      .catch((error) => {
        console.log('error getting data',error);
      });
  };


...

    <View style={{ width: '100%', borderRadius: 8 }}>
         {show && (
            <DateTimePicker
               testID="dateTimePicker"
               value={date}
               mode={mode}
               minimumDate={new Date(1950, 1, 1)}
               maximumDate={moment().subtract(16, 'years').format('YYYY-MM-DDTHH:mm:ss.ssSZ')}
               is24Hour={true}
               display={'default'}
               onChange={onChangeDate}
               style={styles.datePicker}
              />
            )}
     </View>

How can I solve this error?

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

0

You must parse axios response to Date because birthDate in axios response is string. Error message is correct that string doesn't have to getTime method.

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