adapted chatmessage to display statuses
This commit is contained in:
parent
55917125a8
commit
a58cdd954d
9 changed files with 85 additions and 20 deletions
|
|
@ -7,10 +7,15 @@
|
|||
<script>
|
||||
import localeService from 'src/services/locale/locale.service.js'
|
||||
|
||||
import { useMergedConfigStore } from 'src/stores/merged_config.js'
|
||||
|
||||
export default {
|
||||
name: 'Timeago',
|
||||
props: ['date'],
|
||||
props: ['date', 'showTime'],
|
||||
computed: {
|
||||
time12hFormat() {
|
||||
return useMergedConfigStore().mergedConfig.absoluteTimeFormat12h === '12h'
|
||||
},
|
||||
displayDate() {
|
||||
const today = new Date()
|
||||
today.setHours(0, 0, 0, 0)
|
||||
|
|
@ -18,10 +23,17 @@ export default {
|
|||
if (this.date.getTime() === today.getTime()) {
|
||||
return this.$t('display_date.today')
|
||||
} else {
|
||||
return this.date.toLocaleDateString(
|
||||
localeService.internalToBrowserLocale(this.$i18n.locale),
|
||||
{ day: 'numeric', month: 'long' },
|
||||
)
|
||||
if (this.showTime) {
|
||||
return this.date.toLocaleTimeString(
|
||||
localeService.internalToBrowserLocale(this.$i18n.locale),
|
||||
{ hour12: this.time12hFormat, hour: 'numeric', minute: 'numeric' }
|
||||
)
|
||||
} else {
|
||||
return this.date.toLocaleDateString(
|
||||
localeService.internalToBrowserLocale(this.$i18n.locale),
|
||||
{ day: 'numeric', month: 'long' },
|
||||
)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue