aboutsummaryrefslogtreecommitdiffstats
path: root/apps/comments/src
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2023-11-27 15:15:31 +0100
committerFerdinand Thiessen <opensource@fthiessen.de>2023-11-27 15:15:31 +0100
commitc27b94a80f5466921a1e52e651010ad71d9e2e17 (patch)
tree4d45df19ac70709205801371d3966492b8bbabea /apps/comments/src
parentb3e24a6bf274827fe09c604827d0015cc87f1c6f (diff)
downloadnextcloud-server-c27b94a80f5466921a1e52e651010ad71d9e2e17.tar.gz
nextcloud-server-c27b94a80f5466921a1e52e651010ad71d9e2e17.zip
fix(comments): Move from Moment.js to `NcDateTime`
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/comments/src')
-rw-r--r--apps/comments/src/components/Comment.vue18
-rw-r--r--apps/comments/src/components/Moment.vue31
2 files changed, 11 insertions, 38 deletions
diff --git a/apps/comments/src/components/Comment.vue b/apps/comments/src/components/Comment.vue
index de873fb1024..6caf154ce98 100644
--- a/apps/comments/src/components/Comment.vue
+++ b/apps/comments/src/components/Comment.vue
@@ -64,7 +64,10 @@
<div v-if="id && loading" class="comment_loading icon-loading-small" />
<!-- Relative time to the comment creation -->
- <Moment v-else-if="creationDateTime" class="comment__timestamp" :timestamp="timestamp" />
+ <NcDateTime v-else-if="creationDateTime"
+ class="comment__timestamp"
+ :timestamp="timestamp"
+ :ignore-seconds="true" />
</div>
<!-- Message editor -->
@@ -112,17 +115,16 @@
<script>
import { getCurrentUser } from '@nextcloud/auth'
import { translate as t } from '@nextcloud/l10n'
-import moment from '@nextcloud/moment'
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
import NcActions from '@nextcloud/vue/dist/Components/NcActions.js'
import NcActionSeparator from '@nextcloud/vue/dist/Components/NcActionSeparator.js'
import NcAvatar from '@nextcloud/vue/dist/Components/NcAvatar.js'
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
+import NcDateTime from '@nextcloud/vue/dist/Components/NcDateTime.js'
import RichEditorMixin from '@nextcloud/vue/dist/Mixins/richEditor.js'
import ArrowRight from 'vue-material-design-icons/ArrowRight.vue'
-import Moment from './Moment.vue'
import CommentMixin from '../mixins/CommentMixin.js'
// Dynamic loading
@@ -132,13 +134,13 @@ export default {
name: 'Comment',
components: {
+ ArrowRight,
NcActionButton,
NcActions,
NcActionSeparator,
- ArrowRight,
NcAvatar,
NcButton,
- Moment,
+ NcDateTime,
NcRichContenteditable,
},
mixins: [RichEditorMixin, CommentMixin],
@@ -217,9 +219,11 @@ export default {
return !this.localMessage || this.localMessage.trim() === ''
},
+ /**
+ * Timestamp of the creation time (in ms UNIX time)
+ */
timestamp() {
- // seconds, not milliseconds
- return parseInt(moment(this.creationDateTime).format('x'), 10) / 1000
+ return Date.parse(this.creationDateTime)
},
},
diff --git a/apps/comments/src/components/Moment.vue b/apps/comments/src/components/Moment.vue
deleted file mode 100644
index a91ed8b9ce6..00000000000
--- a/apps/comments/src/components/Moment.vue
+++ /dev/null
@@ -1,31 +0,0 @@
-<!-- TODO: Move to vue components -->
-
-<template>
- <span class="live-relative-timestamp" :data-timestamp="timestamp * 1000" :title="title">{{ formatted }}</span>
-</template>
-
-<script>
-import moment from '@nextcloud/moment'
-
-export default {
- name: 'Moment',
- props: {
- timestamp: {
- type: Number,
- required: true,
- },
- format: {
- type: String,
- default: 'LLL',
- },
- },
- computed: {
- title() {
- return moment.unix(this.timestamp).format(this.format)
- },
- formatted() {
- return moment.unix(this.timestamp).fromNow()
- },
- },
-}
-</script>