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

193
Visualizações
How get digits after the decimal points in NumberFormat?

Looking for solution to get full currency value including pennies. numberingSystem: 'fullwide' coming with letter spacing when getting full digits. Is there any option to get full digit with currency code in NumberFormat() ?

Expected behaviour: €56.123456

const CurrencyFormat = (amount = 0, currency = 'eur', digitLength = 'latn') => {
  return new Intl.NumberFormat('en-GB', {
    style: 'currency',
    currency: currency,
    numberingSystem: digitLength,
  }).format(amount)
};

console.log(CurrencyFormat(56.123456, 'eur', 'fullwide'));
console.log(CurrencyFormat(56.123456));

over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Add a maximumFractionDigits property to the options with the number of fractional digits you want to permit.

const CurrencyFormat = (amount = 0, currency = 'eur', digitLength = 'latn') => {
  return new Intl.NumberFormat('en-GB', {
    style: 'currency',
    currency: currency,
    numberingSystem: digitLength,
    maximumFractionDigits: 20,
  }).format(amount)
};

console.log(CurrencyFormat(56.123456, 'eur', 'fullwide'));
console.log(CurrencyFormat(56.123456));

I found this by finding the word MaximumFractionDigits in the specification and discovering that it's a property on instances which can be set through the options object..

over 4 years ago · Santiago Trujillo Relatório

0

maximumFractionDigits helped to get decimal

const CurrencyFormat = (amount = 0, currency = 'eur') => {
  return new Intl.NumberFormat('en-GB', {
    style: 'currency',
    currency: currency,
    maximumFractionDigits: amount.toString().length,
  }).format(amount)
};

console.log(CurrencyFormat(56.123456, 'eur', 'fullwide'));
console.log(CurrencyFormat(56.123456));

over 4 years ago · Santiago Trujillo 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