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

181
Views
xlsx package: Array of object to json -date field value is trimmed for some rows

I am facing a weird issue in xlsx while converting an array of objects to an excel

Input array

const  input=[{id:1,DOb:'02/23/1984'},{id:2,DOb:'02/23/1985'},{id:3,DOb:'02/23/1985'},{id:4,DOb:'02/23/1940'}] 

In the output excel file, the DOB value is trimmed for some rows,

The above example returns the DOB value in excel is 02/23/40 for the input 02/23/1940.

As you see the year 1940 is trimmed to 40 What I need to exact version of the input ie 1940.

Here is the code

    const workSheet = XLSX.utils.json_to_sheet(input)
    const wb = XLSX.utils.book_new()

    XLSX.utils.book_append_sheet(wb, workSheet, 'Sheet1')
    XLSX.writeFile(wb, path)
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!