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

381
Views
DayJS: How to format a date like date-fns.formatISO9075 does in DayJS

I have a file that was using the date-fns.formatISO9075 from date-fns.

const dateFns = require('date-fns')

dateFns.formatISO9075(anniversaryDateLessThanCurrent) 

We're moving to day.js

But I am unclear how to replicate that?

I tried:

dayjs(anniversaryDateGreaterThanCurrent).format('YYYY-MM-DD HH:mm:ss.SSS')

But my test failed.

Any idea how to format that?

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

0

According to the date-fns docs, it appears that using the formatISO9075 function without any options results in the following

// Represent 18 September 2019 in ISO 9075 format:
const result = formatISO9075(new Date(2019, 8, 18, 19, 0, 52))
//=> '2019-09-18 19:00:52'

This would correspond with the following formatting -- 'YYYY-MM-DD HH:mm:ss'

Comparing this to the dayjs code that you posted,

dayjs(anniversaryDateGreaterThanCurrent).format('YYYY-MM-DD HH:mm:ss.SSS')

it's going to return milliseconds as well.

I would expect this to work as expected if you update the format string to

dayjs(anniversaryDateGreaterThanCurrent).format('YYYY-MM-DD HH:mm:ss')
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!