Skip to content

Commit 7ed4b2b

Browse files
committed
chore(schema): replace moment usage with Date
1 parent 05a557b commit 7ed4b2b

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

package-lock.json

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

packages/compass-schema/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@
8989
"leaflet-defaulticon-compatibility": "^0.1.1",
9090
"leaflet-draw": "^1.0.4",
9191
"lodash": "^4.17.21",
92-
"moment": "^2.29.4",
9392
"mongodb": "^6.9.0",
9493
"mongodb-query-util": "^2.2.9",
9594
"mongodb-schema": "^12.2.0",

packages/compass-schema/src/modules/date.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-disable no-use-before-define */
22
import d3 from 'd3';
33
import { isEqual, range, minBy, maxBy, sortBy, groupBy, map } from 'lodash';
4-
import moment from 'moment';
54
import { inValueRange } from 'mongodb-query-util';
65
import { palette, spacing } from '@mongodb-js/compass-components';
76

@@ -33,7 +32,15 @@ const minicharts_d3fns_date = (changeQueryFn) => {
3332
const options = {};
3433
const subcharts = [];
3534

36-
const weekdayLabels = moment.weekdays();
35+
const weekdayLabels = [
36+
'Sunday',
37+
'Monday',
38+
'Tuesday',
39+
'Wednesday',
40+
'Thursday',
41+
'Friday',
42+
'Saturday',
43+
];
3744

3845
// A formatter for dates
3946
const format = d3.time.format.utc('%Y-%m-%d %H:%M:%S');
@@ -215,7 +222,7 @@ const minicharts_d3fns_date = (changeQueryFn) => {
215222

216223
// group by weekdays
217224
const w = groupBy(values, function (d) {
218-
return moment(d.ts).weekday();
225+
return new Date(d.ts).getDay();
219226
});
220227
const wd = { ...generateDefaults(7), ...w };
221228
const weekdays = map(wd, function (d, i) {

0 commit comments

Comments
 (0)