From 68ef7e4e65ed00b5af85d1b089ca2e629665445a Mon Sep 17 00:00:00 2001 From: Tusooa Zhu Date: Thu, 14 Jul 2022 18:42:28 -0400 Subject: [PATCH] Add published time for announcements --- src/components/announcement/announcement.js | 8 ++++++++ src/components/announcement/announcement.vue | 3 +++ 2 files changed, 11 insertions(+) diff --git a/src/components/announcement/announcement.js b/src/components/announcement/announcement.js index 20f8c62f..993e3655 100644 --- a/src/components/announcement/announcement.js +++ b/src/components/announcement/announcement.js @@ -33,6 +33,14 @@ const Announcement = { isRead () { return this.announcement.read }, + publishedAt () { + const time = this.announcement['published_at'] + if (!time) { + return + } + + return this.formatTimeOrDate(time, localeService.internalToBrowserLocale(this.$i18n.locale)) + }, startsAt () { const time = this.announcement['starts_at'] if (!time) { diff --git a/src/components/announcement/announcement.vue b/src/components/announcement/announcement.vue index 72d99d85..823e496c 100644 --- a/src/components/announcement/announcement.vue +++ b/src/components/announcement/announcement.vue @@ -20,6 +20,9 @@ v-if="!editing" class="times" > + + {{ $t('announcements.published_time_display', { time: publishedAt }) }} + {{ $t('announcements.start_time_display', { time: startsAt }) }}