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:
Mengnan Gong
2022-10-18 16:05:43 +08:00
parent e167b944ae
commit 80d75adf3a
4 changed files with 9 additions and 4 deletions
@@ -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 = (