Skip to content

Commit edb35a3

Browse files
committed
Remove moment from dependencies
1 parent 64b4776 commit edb35a3

File tree

5 files changed

+10
-28
lines changed

5 files changed

+10
-28
lines changed

docs/axes/cartesian/time.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ The time scale is used to display times and dates. When building its ticks, it w
44

55
## Date Adapters
66

7-
The time scale requires both a date library and corresponding adapter to be present. By default, Chart.js includes an adapter for Moment.js. You may wish to [exclude moment](../../getting-started/integration.md) and choose from [other available adapters](https://github.com/chartjs/awesome#adapters) instead.
7+
The time scale requires both a date library and corresponding adapter to be present. By default, Chart.js includes an adapter for Moment.js. You may wish to choose from [other available adapters](https://github.com/chartjs/awesome#adapters) instead.
88

99
## Data Sets
1010

docs/getting-started/integration.md

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,26 +25,6 @@ import Chart from 'chart.js';
2525
var myChart = new Chart(ctx, {...});
2626
```
2727

28-
**Note:** Moment.js is installed along Chart.js as dependency. If you don't want to use Moment.js (either because you use a different date adapter or simply because don't need time functionalities), you will have to configure your bundler to exclude this dependency (e.g. using [`externals` for Webpack](https://webpack.js.org/configuration/externals/) or [`external` for Rollup](https://rollupjs.org/guide/en#peer-dependencies)).
29-
30-
```javascript
31-
// Webpack
32-
{
33-
externals: {
34-
moment: 'moment'
35-
}
36-
}
37-
```
38-
39-
```javascript
40-
// Rollup
41-
{
42-
external: {
43-
['moment']
44-
}
45-
}
46-
```
47-
4828
## Require JS
4929

5030
**Important:** RequireJS [can **not** load CommonJS module as is](https://requirejs.org/docs/commonjs.html#intro), so be sure to require one of the UMD builds instead (i.e. `dist/Chart.js`, `dist/Chart.min.js`, etc.).
@@ -55,7 +35,7 @@ require(['path/to/chartjs/dist/Chart.min.js'], function(Chart){
5535
});
5636
```
5737

58-
**Note:** starting v2.8, Moment.js is an optional dependency for `Chart.js` and `Chart.min.js`. In order to use the time scale with Moment.js, you need to make sure Moment.js is fully loaded **before** requiring Chart.js. You can either use a shim:
38+
**Note:** starting v2.8, in order to use the time scale, you need to make sure [one of the available date adapters](https://github.com/chartjs/awesome#adapters) and corresponding date library are fully loaded **before** requiring Chart.js. The date adapter for Moment.js is included with Chart.js, but you still need to include Moment.js itself if this is the date adapter you choose to use. You can either use a shim:
5939

6040
```javascript
6141
require.config({

docs/getting-started/v3-migration.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
Chart.js 3.0 introduces a number of breaking changes. Chart.js 2.0 was released in April 2016. In the years since then, as Chart.js has grown in popularity and feature set, we've learned some lessons about how to better create a charting library. In order to improve performance, offer new features, and improve maintainability it was necessary to break backwards compatibility, but we aimed to do so only when necessary.
44

5-
## Setup
5+
## End user migration
66

7-
Chart.js is no longer providing the `Chart.bundle.js` and `Chart.bundle.min.js`. Please see the [installation](installation.md) and [integration](integration.md) docs for details on the recommended way to setup Chart.js if you were using these builds.
7+
### Setup and installation
88

9-
## End user migration
9+
* Chart.js is no longer providing the `Chart.bundle.js` and `Chart.bundle.min.js`. Please see the [installation](installation.md) and [integration](integration.md) docs for details on the recommended way to setup Chart.js if you were using these builds.
10+
* `moment` is no longer specified as an npm dependency. If you are using the time scale, you must include one of [the available adapters](https://github.com/chartjs/awesome#adapters) and corresponding date library.
1011

1112
### Ticks
1213

package-lock.json

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"karma-rollup-preprocessor": "^7.0.0",
6262
"karma-safari-private-launcher": "^1.0.0",
6363
"merge-stream": "^1.0.1",
64+
"moment": "^2.10.2",
6465
"pixelmatch": "^5.0.0",
6566
"rollup": "^1.0.0",
6667
"rollup-plugin-babel": "^4.3.3",
@@ -71,7 +72,6 @@
7172
"yargs": "^14.0.0"
7273
},
7374
"dependencies": {
74-
"chartjs-color": "^2.1.0",
75-
"moment": "^2.10.2"
75+
"chartjs-color": "^2.1.0"
7676
}
7777
}

0 commit comments

Comments
 (0)