fix notification time display

This commit is contained in:
isUnknown 2024-11-18 12:20:51 +01:00
parent f4c74db7df
commit cdf663d4ca

View file

@ -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>