notifications : fix sorting

This commit is contained in:
isUnknown 2024-11-22 09:53:58 +01:00
parent bb44f7727e
commit 62b2b8c617
2 changed files with 6 additions and 5 deletions

View file

@ -16,6 +16,9 @@ return [
'isValidated' => 'true'
]);
$timezone = new DateTimeZone('Europe/Paris');
$dateTime = new DateTime('now', $timezone);
$notification = [
'location' => [
'href' => (string) $href,
@ -24,7 +27,7 @@ return [
'uri' => (string) $project->url()
]
],
'date' => $newPage->modified('YYYY-MM-DD'),
'date' => $dateTime->format('Y-m-d\TH:i:sP'),
'author' => [
'name' => (string) kirby()->user()->name(),
'email' => (string) kirby()->user()->email(),

View file

@ -137,11 +137,9 @@ const tabs = computed(() => {
});
const sortedNotifications = computed(() => {
const sortedNotifications = notifications.value.sort((a, b) => {
dayjs(b.date).diff(dayjs(a.date));
return [...notifications.value].sort((a, b) => {
return dayjs(b.date).diff(dayjs(a.date));
});
return sortedNotifications;
});
function changeTab(newValue) {