Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

192
Visualizações
Invalid Date returned by day.js in Firefox

I am having a date in the format 2022-01-27 09:23:48 UTC and I am parsing the date into MMMM-DD-YYYY format (Jan-27-2022) using day.js .Its working fine in chrome but firefox is returning Invalid.

import dayjs from "dayjs"

const utcDate = '2022-01-27 09:23:48 UTC'
const formatedDate = dayjs(utcDate).format("MMMM-DD-YYYY")

I have also tried the customParseFormat mentioned in the docs and some other threads

import dayjs from "dayjs"
import customParseFormat from 'dayjs/plugin/customParseFormat'
dayjs.extend(customParseFormat)

const utcDate = '2022-01-27 09:23:48 UTC'
const formatedDate = dayjs(utcDate, 'MMMM-DD-YYYY')

In both cases its returning 'Invalid Date' in firefox and safari but working fine in chrome. Is there any work around for this?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Issue got resolved. Credits @pilchard

import dayjs from "dayjs"

const utcDate = '2022-01-27 09:23:48 UTC'
const formatedDate = dayjs(utcDate.slice(0, -4)).format("MMMM-DD-YYYY")
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda