Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove remaining dependencies on Moment.js #7716

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/frontend/app/components/locale-chooser.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { findById, uniqueValues } from 'ilios-common/utils/array-helpers';

export default class LocaleChooserComponent extends Component {
@service intl;
@service moment;
@tracked isOpen = false;
@tracked menuElement;
@tracked menuButtonElement;
Expand Down Expand Up @@ -47,7 +46,6 @@ export default class LocaleChooserComponent extends Component {
changeLocale(id) {
this.isOpen = false;
this.intl.setLocale(id);
this.moment.setLocale(id);
window.document.querySelector('html').setAttribute('lang', id);
this.menuButtonElement.focus();
}
Expand Down
2 changes: 0 additions & 2 deletions packages/frontend/app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { launchWorker } from '../utils/launch-worker';
export default class AuthenticatedRoute extends Route {
@service currentUser;
@service intl;
@service moment;
@service store;
@service router;
@service session;
Expand All @@ -20,7 +19,6 @@ export default class AuthenticatedRoute extends Route {
await this.session.setup();
await loadPolyfills();
const locale = this.intl.get('primaryLocale');
this.moment.setLocale(locale);
window.document.querySelector('html').setAttribute('lang', locale);
}

Expand Down
6 changes: 2 additions & 4 deletions packages/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@
"ember-load-initializers": "^2.1.2",
"ember-metrics": "1.5.2",
"ember-modifier": "^4.1.0",
"ember-moment": "^10.0.0",
"ember-noscript": "^4.1.0",
"ember-page-title": "^8.2.0",
"ember-qunit": "^8.0.2",
Expand Down Expand Up @@ -146,7 +145,6 @@
},
"private": true,
"dependencies": {
"ember-auto-import": "^2.7.2",
"moment": "^2.30.1"
"ember-auto-import": "^2.7.2"
}
}
}
11 changes: 0 additions & 11 deletions packages/ilios-common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const WriteFile = require('broccoli-file-creator');
const SetTransform = require('./lib/set-transform');
const HasErrorForTransform = require('./lib/has-error-for-transform');
const GetErrorsForTransform = require('./lib/get-errors-for-transform');
const MomentLocalesPlugin = require('moment-locales-webpack-plugin');

module.exports = {
name: require('./package').name,
Expand All @@ -20,16 +19,6 @@ module.exports = {
require.resolve('ember-concurrency/async-arrow-task-transform'),
],
},
autoImport: {
webpack: {
plugins: [
new MomentLocalesPlugin({
// 'en' is built into moment and cannot be removed. This strips the others.
localesToKeep: ['es', 'fr'],
}),
],
},
},
},

included: function () {
Expand Down
3 changes: 0 additions & 3 deletions packages/ilios-common/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
"ember-intl": "^6.5.3",
"ember-math-helpers": "^4.0.0",
"ember-modifier": "^4.0.0",
"ember-moment": "^10.0.0",
"ember-simple-auth": "^6.0.0",
"ember-simple-charts": "^11.1.2",
"ember-test-selectors": "^6.0.0",
Expand All @@ -63,7 +62,6 @@
"froala-editor": ">= 4.0.0",
"luxon": ">= 3.0.0",
"mockdate": ">= 3.0.0",
"moment-locales-webpack-plugin": "^1.2.0",
"normalize.css": "^8.0.1",
"query-string": ">= 9.0.0",
"scroll-into-view": ">= 1.16.0",
Expand All @@ -80,7 +78,6 @@
"froala-editor": ">= 4.0.0",
"luxon": ">= 3.0.0",
"mockdate": ">= 3.0.0",
"moment": ">= 2.29.0",
"query-string": ">= 9.0.0",
"scroll-into-view": ">= 1.16.0",
"striptags": ">= 3.2.0",
Expand Down
3 changes: 0 additions & 3 deletions packages/lti-course-manager/app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,12 @@ import { inject as service } from '@ember/service';

export default class ApplicationRoute extends Route {
@service intl;
@service moment;
@service currentUser;
@service session;

async beforeModel() {
await this.session.setup();
const intl = this.intl;
const moment = this.moment;
moment.setLocale(intl.locale[0]);
window.document.querySelector('html').setAttribute('lang', intl.locale);
}

Expand Down
3 changes: 0 additions & 3 deletions packages/lti-dashboard/app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@ import Route from '@ember/routing/route';
import { inject as service } from '@ember/service';
export default class ApplicationRoute extends Route {
@service intl;
@service moment;
@service currentUser;
@service session;

async beforeModel() {
await this.session.setup();
const intl = this.intl;
const moment = this.moment;
moment.setLocale(intl.locale[0]);
window.document.querySelector('html').setAttribute('lang', intl.locale);
}

Expand Down
2 changes: 0 additions & 2 deletions packages/test-app/app/routes/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ import { loadPolyfills } from 'ilios-common/utils/load-polyfills';
export default class ApplicationRoute extends Route {
@service session;
@service intl;
@service moment;

async beforeModel(transition) {
await this.session.setup();
this.session.requireAuthentication(transition, 'login');
await loadPolyfills();
this.intl.setLocale('en-us');
this.moment.setLocale('en');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,6 @@ module('Integration | Component | monthly-calendar', function (hooks) {
assert.ok(component.days[0].isFirstWeek);
assert.strictEqual(component.days[0].events.length, 1);
this.owner.lookup('service:intl').setLocale('es');
this.owner.lookup('service:moment').setLocale('es');
await settled();

assert.strictEqual(component.days.length, 29);
Expand Down
68 changes: 1 addition & 67 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.