Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

337
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!