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

238
Views
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 answers
Answer question

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