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

76
Visualizações
dayjs localizedFormat not showing special characters

I used moment to format date strings for a lot of different languages. Now I want to migrate from moment to dayjs so I created a new function that should create me localized date strings like this:

import * as dayjs from 'dayjs';
import * as localizedFormat from 'dayjs/plugin/localizedFormat';
import 'dayjs/locale/ar';
// ... 57 more locales

dayjs.extend(localizedFormat);

const formatDate = (date:Date, locale:string) => {
    return dayjs(date).locale(locale).format("L");
};

for 42 locales it works fine but the ones with e.g. asian or arabic characters are not properly displayed. When I did the same previously with moment using moment(date).locale(locale).format("L") instead I got a proper response. For e.g. arabic(ar) I got with moment ١٧/‏١/‏٢٠٢٢ and with dayjs 01/17/2022 but if I open the imported locale in dayjs/locale/ar I can see that they have strings with these characters in place and just don't use them.

This happens for ar, bn, fa, hi, km, my, pa, si and a couple of other ones that have e.g. days and months twisted, but that I could change myself.

Is there anything I do wrong?

Thanks in advance :)

about 4 years ago · Juan Pablo Isaza
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