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

227
Views
TypeError: value.getTime no es una función. (En 'value.getTime()', 'value.getTime' no está definido)

Estoy tratando de editar los datos del perfil del usuario (que tiene el nombre completo, el sexo y la fecha de nacimiento). De lejos, cuando edito la fecha de nacimiento y el nombre, se editan los datos del perfil. Pero cuando solo cambio el nombre y lo guardo, muestra este error: TypeError: value.getTime no es una función. (En 'value.getTime()', 'value.getTime' no está definido)

 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>

¿Cómo puedo solucionar este error?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Debe analizar la respuesta de axios a Fecha porque la fecha de nacimiento en la respuesta de axios es una cadena. El mensaje de error es correcto, esa cadena no tiene que usar el método getTime.

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!