From 3ec86ff23a1333a12c66ba3b79dd0cd7fdabcab9 Mon Sep 17 00:00:00 2001 From: fboulnois Date: Wed, 4 Dec 2024 10:11:07 -0500 Subject: [PATCH] [DT-1079] Switch from MomentJS to DayJS (#2740) --- package-lock.json | 20 +++---------------- package.json | 2 +- .../library_card_table/LibraryCardTable.jsx | 4 ++-- 3 files changed, 6 insertions(+), 20 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8951d56be..951d70ed8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,11 +19,11 @@ "ajv": "8.17.1", "ajv-formats": "3.0.1", "axios": "1.7.8", + "dayjs": "1.11.3", "dompurify": "3.2.2", "js-file-download": "0.4.12", "lodash": "4.17.21", "mixin-deep": "2.0.1", - "moment": "2.30.1", "noty": "3.2.0-beta", "oidc-client-ts": "3.1.0", "query-string": "9.1.1", @@ -8140,7 +8140,7 @@ "version": "1.11.3", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.3.tgz", "integrity": "sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A==", - "dev": true + "license": "MIT" }, "node_modules/debug": { "version": "4.3.4", @@ -15914,14 +15914,6 @@ "mkdirp": "bin/cmd.js" } }, - "node_modules/moment": { - "version": "2.30.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", - "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==", - "engines": { - "node": "*" - } - }, "node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -28822,8 +28814,7 @@ "dayjs": { "version": "1.11.3", "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.3.tgz", - "integrity": "sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A==", - "dev": true + "integrity": "sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A==" }, "debug": { "version": "4.3.4", @@ -34485,11 +34476,6 @@ "minimist": "^1.2.6" } }, - "moment": { - "version": "2.30.1", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.30.1.tgz", - "integrity": "sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==" - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", diff --git a/package.json b/package.json index b5b79e286..83e36340a 100644 --- a/package.json +++ b/package.json @@ -14,11 +14,11 @@ "ajv": "8.17.1", "ajv-formats": "3.0.1", "axios": "1.7.8", + "dayjs": "1.11.3", "dompurify": "3.2.2", "js-file-download": "0.4.12", "lodash": "4.17.21", "mixin-deep": "2.0.1", - "moment": "2.30.1", "noty": "3.2.0-beta", "oidc-client-ts": "3.1.0", "query-string": "9.1.1", diff --git a/src/components/library_card_table/LibraryCardTable.jsx b/src/components/library_card_table/LibraryCardTable.jsx index 2239d9ff0..076009f4c 100644 --- a/src/components/library_card_table/LibraryCardTable.jsx +++ b/src/components/library_card_table/LibraryCardTable.jsx @@ -1,4 +1,4 @@ -import moment from 'moment'; +import dayjs from 'dayjs'; import React, { useState, useEffect, useRef, useCallback } from 'react'; import ReactTooltip from 'react-tooltip'; import { Notifications, searchOnFilteredList, calcTablePageCount, calcVisibleWindow, getSearchFilterFunctions} from '../../libs/utils'; @@ -77,7 +77,7 @@ const eraCommonsCell = (eraCommonsId, id) => { const createDateCell = (createDate, id) => { return { - data: !isNil(createDate) ? moment(createDate).format('YYYY-MM-DD') : '- -', + data: !isNil(createDate) ? dayjs(createDate).format('YYYY-MM-DD') : '- -', id, style: { width: styles.cellWidths.createDate }, label: 'create-date',