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

110
Visualizações
Hebrew date format with momentjs

I changed locale to 'he' and use this format:

moment().format('D MMM') 

it formated like this: 3 אפר׳ but I want to show date with this symbol 'ב' which means (3 in Apr) like this: 3 באפר׳

How can I make this? Thanks in advance

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

0

The format string can contain other characters than just date part placeholders, you can do it directly:

moment.locale('he');

console.log(moment('2022-04-03').format('D בMMM'));
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.3/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.29.3/locale/he.js"></script>

about 4 years ago · Juan Pablo Isaza Relatório

0

You can do this without moment at all. The Intl object does this without any additional libraries in modern JS. If you want to support IE then you might need moment, if not, I'd recommend using Intl over moment. Not least of which, because moment is deprecated.

const intl = new Intl.DateTimeFormat('he', {month: "short", day:"numeric"});
console.log(intl.format(new Date('2022-04-03')));

about 4 years ago · Juan Pablo Isaza Relatório

0

I dont think that there is a built in method for that in moment.js, but you can use regex:

moment().format('D MMM').replace(/\d+? /, '$&ב')

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