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

231
Visualizações
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 Respostas
Responde à pergunta

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 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