Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

378
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda