From 923cc5d81edb148a1c17241d0ab1dd51252ebe33 Mon Sep 17 00:00:00 2001 From: elweyn Date: Thu, 9 Mar 2023 15:14:16 +0100 Subject: [PATCH] Extract format date or - to a method. --- admin/src/pages/CreationConfirm.vue | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/admin/src/pages/CreationConfirm.vue b/admin/src/pages/CreationConfirm.vue index 06c4e0797..4d57ed417 100644 --- a/admin/src/pages/CreationConfirm.vue +++ b/admin/src/pages/CreationConfirm.vue @@ -184,6 +184,9 @@ export default { this.items.find((obj) => obj.id === id).messagesCount++ this.items.find((obj) => obj.id === id).state = 'IN_PROGRESS' }, + formatDateOrDash(value) { + return value ? this.$d(new Date(value), 'short') : '-' + }, }, computed: { fields() { @@ -206,7 +209,7 @@ export default { key: 'contributionDate', label: this.$t('created'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'moderator', label: this.$t('moderator') }, @@ -229,21 +232,21 @@ export default { key: 'contributionDate', label: this.$t('created'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'createdAt', label: this.$t('createdAt'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'confirmedAt', label: this.$t('contributions.confirms'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'confirmedBy', label: this.$t('moderator') }, @@ -265,21 +268,21 @@ export default { key: 'contributionDate', label: this.$t('created'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'createdAt', label: this.$t('createdAt'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'deniedAt', label: this.$t('contributions.denied'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'deniedBy', label: this.$t('moderator') }, @@ -301,21 +304,21 @@ export default { key: 'contributionDate', label: this.$t('created'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'createdAt', label: this.$t('createdAt'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'deletedAt', label: this.$t('contributions.deleted'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'deletedBy', label: this.$t('moderator') }, @@ -338,21 +341,21 @@ export default { key: 'contributionDate', label: this.$t('created'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'createdAt', label: this.$t('createdAt'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'confirmedAt', label: this.$t('contributions.confirms'), formatter: (value) => { - return value ? this.$d(new Date(value), 'short') : '-' + return this.formatDateOrDash(value) }, }, { key: 'confirmedBy', label: this.$t('moderator') },