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

133
Views
parse timestamp into date with AvField[type=date]

I'm using availity-reactstrap-validation module with react library,

I have an AvField[type=date] which I get an timestamp from the API, and I want to parse the date into the AvField's value.

I have formatted the timestamp to this format: YYYY/MM/DD as below:

const scheduleDate = new Date(parseInt(candidateObject.scheduleDate));
scheduleDate: scheduleDate.getFullYear()+"-"+scheduleDate.getMonth()+"-"+scheduleDate.getDate()

And this is the AvField:

<AvField
    name="scheduleDate"
    type="date"
    placeholder=""
    value={innerCandidate.scheduleDate}
    onChange={(e) => {
       setInnerCandidate({
       ...innerCandidate,
       scheduleDate: e.target.value
      })
    }}
 />

for some reason the field remain with his placeholder, but holding the new date in the value.

here is the whole code that receive and update the data:

const CandidateForm = ({candidateObject = {}, history, handleSubmitForm}) => {
    const [innerCandidate, setInnerCandidate] = useState({})
    const [departmentList, setDepartmentList] = useState([])
    const [userPermission, setUserPermission] = useState(0)
    useEffect(() => {
        setUserPermission(localStorage.getItem("permission"));
        if (Object.keys(candidateObject).length > 0) // if exists update the state. //UPDATE COMPONENT
        {
            const scheduleDate = new Date(parseInt(candidateObject.scheduleDate));
            const modifyiedCandidateObject = {
                ...candidateObject,
                scheduleDate: scheduleDate.getFullYear()+"-"+scheduleDate.getMonth()+"-"+scheduleDate.getDate()
            }
            setInnerCandidate(modifyiedCandidateObject)
        }
        // eslint-disable-next-line react-hooks/exhaustive-deps
    }, [candidateObject.id])

    return ()
}
about 4 years ago · Juan Pablo Isaza
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!