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

338
Visualizações
chart.js using date-fns without node.js

As the title tells, I want to use chart.js with date-fns adapter without node.js.

I downloaded npm package manager and installed in my project folder.

In my HTML File with my chart.js chart I imported the script:

<script type="text/javascript" src="node\node_modules\chartjs-adapter-date-fns\dist\chartjs-adapter-date-fns.bundle.js"></script>

Everything is working so far and my chart is displayed and formated with date-fns. But now I want to use the localization feature of date-fns and want the chart for example in german.

chart.js documentation tells me to use following code (https://github.com/chartjs/chartjs-adapter-date-fns):

// import date-fns locale:
import {de} from 'date-fns/locale';

// scale options:
{
    adapters: {
        date: {
            locale: de
        }
    }
}

I dont understand how/where I can import the module or what is the correct syntax. I just simply want to a js script and no environtment.

"import {de} from 'date-fns/locale';

After putting this in my HTML file / chart.js code, leaving the "import code" the chart is not showing up and the browser tells me following error message:

uncaught ReferenceError: de is not defined
    at (index):313:21 

Also really hard to find could tutorials etc. Chart.js & date-fns documentation require a lot of knowledge and are not very helpfull. So anyone can give me a clue how to import "locale".

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