Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

336
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda