fix notification time display
This commit is contained in:
parent
f4c74db7df
commit
cdf663d4ca
1 changed files with 17 additions and 1 deletions
|
|
@ -60,7 +60,7 @@
|
|||
<time
|
||||
datetime=""
|
||||
class="notification__date | text-grey-700 | ml-auto"
|
||||
>17:06</time
|
||||
>{{ formatDate(notification) }}</time
|
||||
>
|
||||
</p>
|
||||
</header>
|
||||
|
|
@ -145,6 +145,22 @@ const sortedNotifications = computed(() => {
|
|||
function changeTab(newValue) {
|
||||
currentTab.value = newValue;
|
||||
}
|
||||
|
||||
function formatDate(notification) {
|
||||
const notificationDigitalDate = parseInt(
|
||||
dayjs(notification.date).format("YYYYMMDD")
|
||||
);
|
||||
const todayDigitalDate = parseInt(dayjs().format("YYYYMMDD"));
|
||||
const isToday = notificationDigitalDate === todayDigitalDate;
|
||||
|
||||
if (isToday) {
|
||||
return dayjs(notification.date).format("h:m");
|
||||
} else if (todayDigitalDate === notificationDigitalDate + 1) {
|
||||
return "hier";
|
||||
} else {
|
||||
return dayjs(notification.date).format("DD MMM YY");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue