stable

Clone or download

Read-only

refactor: replace moment by Intl.DateTimeFormat in pull requests

part of request #35496 Drop moment.js from places using tlp-relative-date How to test: - Go to a Git repository with pull requests, browse a pull request. - The following dates should all be shown in the format matching your locale: DD/MM/YYYY HH:mm for French, YYYY-MM-DD HH:mm "ISO-like" for English and other locales: - In the Overview tab, the pull request's creation date - each comment's creation and edition dates - each timeline event (Pull request updated, closed, reopened) date - In the Commits tab, the commit dates - the Continuous Integration badge dates - In the Changes tab, the inline comments' creation and edition dates - When you change your timezone in user preferences and go back to the pages, the "absolute" date should adapt accordingly. For example, choosing "Pacific/Tahiti" could change the day number and the hour. Why? Moment.js is end-of-life. We have built a replacement that uses the native Intl.DateTimeFormat and that correctly takes user timezone into account. It also reduces the weight of the apps: pullrequest-overview: 701.58 kB -> 581.01 kB pullrequests-app: 1.28 MiB -> 1.16 MiB Change-Id: I8a0a9ba2b5ef9ff147e9f23f17fd380fafddb226

Modified Files

Name
M plugins/pullrequest/scripts/lib/pullrequest-comments/package.json +0 −1 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/pnpm-lock.yaml +0 −7 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/PullRequestCommentController.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/comment/comment-reply/PullRequestCommentReplyController.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/description-comment/PullRequestDescriptionCommentController.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/helpers/relative-dates-helper.ts +18 −16 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/templates/CommentHeaderTemplate.test.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/timeline-event/TimelineEvent.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/src/types.ts +3 −2 Go to diff View file
M plugins/pullrequest/scripts/lib/pullrequest-comments/tests/stubs/CurrentPullRequestUserPresenterStub.ts +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/package.json +0 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/pnpm-lock.yaml +0 −7 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/ReadOnlyInfo/PullRequestRelativeDate.test.ts +2 −2 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/ReadOnlyInfo/PullRequestRelativeDate.vue +14 −15 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Threads/OverviewThreads.test.ts +7 −7 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/components/Threads/OverviewThreads.vue +21 −22 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/constants.ts +3 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequest-overview/src/pullrequest-overview.ts +7 −6 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/package.json +0 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/pnpm-lock.yaml +0 −7 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/app-controller.js +3 −2 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCurrentUserPresenterBuilder.test.ts +3 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/comments/PullRequestCurrentUserPresenterBuilder.ts +4 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/commits/commits-controller.js +8 −3 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/side-by-side-diff-component.js +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/file-diff/diff-modes/unidiff-component.js +1 −1 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/helpers/date-helpers.ts +18 −16 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/src/app/shared-properties/shared-properties-service.js +7 −7 Go to diff View file
M plugins/pullrequest/scripts/pullrequests-app/webpack.common.js +0 −1 Go to diff View file