
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
chartjs-adapter-date-fns
Advanced tools
This adapter allows the use of date-fns with Chart.js.
Requires Chart.js 2.8.0 or later and date-fns 2.0.0 or later.
Note: once loaded, this adapter overrides the default date-adapter provided in Chart.js (as a side-effect).
npm install date-fns chartjs-adapter-date-fns --save
import { Chart } from 'chart.js';
import 'chartjs-adapter-date-fns';
By default, https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns returns the latest (minified) version, however it's highly recommended to always specify a version in order to avoid breaking changes. This can be achieved by appending @{version} to the url:
<script src="https://cdn.jsdelivr.net/npm/chart.js/dist/chart.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/chartjs-adapter-date-fns/dist/chartjs-adapter-date-fns.bundle.min.js"></script>
Read more about jsDeliver versioning on their website.
date-fns requires a date-fns locale object to be tagged on to each format() call, which requires the locale to be explicitly set via the adapters.date option: Chart.js documentation on adapters.date
For example:
// import date-fns locale:
import {de} from 'date-fns/locale';
// scale options:
{
adapters: {
date: {
locale: de
}
}
}
Further, read the Chart.js documentation for other possible date/time related options. For example, the time scale time.* options can be overridden using the date-fns tokens.
You first need to install node dependencies (requires Node.js):
> npm install
The following commands will then be available from the repository root:
> npm run build // build dist files
> npm run lint // perform code linting
chartjs-adapter-date-fns is available under the MIT license.
The chartjs-adapter-moment package is an adapter for Chart.js that allows you to use Moment.js for date manipulation and formatting. It provides similar functionalities to chartjs-adapter-date-fns but uses Moment.js instead of date-fns. Moment.js is known for its comprehensive date and time manipulation capabilities, but it is larger in size compared to date-fns.
The chartjs-adapter-luxon package is an adapter for Chart.js that allows you to use Luxon for date manipulation and formatting. Luxon is a modern JavaScript date library that offers a more comprehensive and immutable API compared to date-fns. It is also known for its better support for time zones and internationalization.
FAQs
Chart.js adapter to use date-fns for time functionalities
The npm package chartjs-adapter-date-fns receives a total of 360,411 weekly downloads. As such, chartjs-adapter-date-fns popularity was classified as popular.
We found that chartjs-adapter-date-fns demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.