Cleanup the momentjs dependency in @backstage/plugin-github-pull-requests-board
As per [ADR010: Use the Luxon Date Library](https://github.com/backstage/backstage/blob/master/docs/architecture-decisions/adr010-luxon-date-library.md), we should replace momentjs with luxon. Signed-off-by: Mengnan Gong <namco1992@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-github-pull-requests-board': patch
|
||||
---
|
||||
|
||||
Replace the momentjs dependency with luxon.
|
||||
@@ -44,7 +44,7 @@
|
||||
"@material-ui/icons": "^4.9.1",
|
||||
"@material-ui/lab": "4.0.0-alpha.57",
|
||||
"@octokit/rest": "^19.0.3",
|
||||
"moment": "^2.29.1",
|
||||
"luxon": "^3.0.0",
|
||||
"react-use": "^17.2.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import moment from 'moment';
|
||||
import { DateTime } from 'luxon';
|
||||
import {
|
||||
Reviews,
|
||||
PullRequests,
|
||||
@@ -58,7 +58,7 @@ export const filterSameUser = (users: Author[]): Author[] => {
|
||||
};
|
||||
|
||||
export const getElapsedTime = (start: string): string => {
|
||||
return moment(start).fromNow();
|
||||
return DateTime.fromISO(start).toRelative() ?? start;
|
||||
};
|
||||
|
||||
export const formatPRsByReviewDecision = (
|
||||
|
||||
Reference in New Issue
Block a user