mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-03-09 22:23:28 +08:00
Merge pull request #5309 from aignatov-bio/ai-sci-8325-fix-date-sorting-in-notifications
Fix date sorting in notifications [SCI-8325]
This commit is contained in:
commit
18590b502d
2 changed files with 3 additions and 4 deletions
|
@ -65,6 +65,7 @@ class UserNotificationsController < ApplicationController
|
||||||
title: notification.title,
|
title: notification.title,
|
||||||
message: notification.message,
|
message: notification.message,
|
||||||
created_at: I18n.l(notification.created_at, format: :full),
|
created_at: I18n.l(notification.created_at, format: :full),
|
||||||
|
today: notification.created_at.today?,
|
||||||
checked: notification.checked
|
checked: notification.checked
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
|
@ -75,12 +75,10 @@ export default {
|
||||||
this.loadNotifications();
|
this.loadNotifications();
|
||||||
},
|
},
|
||||||
todayNotifications() {
|
todayNotifications() {
|
||||||
let startOfDay = (new Date()).setUTCHours(0, 0, 0, 0);
|
return this.notifications.filter(n => n.today);
|
||||||
return this.notifications.filter(n => moment(n.created_at) >= startOfDay);
|
|
||||||
},
|
},
|
||||||
olderNotifications() {
|
olderNotifications() {
|
||||||
let startOfDay = (new Date()).setUTCHours(0, 0, 0, 0);
|
return this.notifications.filter(n => !n.today);
|
||||||
return this.notifications.filter(n => moment(n.created_at) < startOfDay);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
Loading…
Reference in a new issue