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
|
<time
|
||||||
datetime=""
|
datetime=""
|
||||||
class="notification__date | text-grey-700 | ml-auto"
|
class="notification__date | text-grey-700 | ml-auto"
|
||||||
>17:06</time
|
>{{ formatDate(notification) }}</time
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
</header>
|
</header>
|
||||||
|
|
@ -145,6 +145,22 @@ const sortedNotifications = computed(() => {
|
||||||
function changeTab(newValue) {
|
function changeTab(newValue) {
|
||||||
currentTab.value = 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>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue