diff --git a/app/controllers/user_notifications_controller.rb b/app/controllers/user_notifications_controller.rb index 9f7c452c2..78ad05287 100644 --- a/app/controllers/user_notifications_controller.rb +++ b/app/controllers/user_notifications_controller.rb @@ -65,6 +65,7 @@ class UserNotificationsController < ApplicationController title: notification.title, message: notification.message, created_at: I18n.l(notification.created_at, format: :full), + today: notification.created_at.today?, checked: notification.checked } end diff --git a/app/javascript/vue/navigation/notifications/notifications_flyout.vue b/app/javascript/vue/navigation/notifications/notifications_flyout.vue index 0b8c22c83..036824ede 100644 --- a/app/javascript/vue/navigation/notifications/notifications_flyout.vue +++ b/app/javascript/vue/navigation/notifications/notifications_flyout.vue @@ -75,12 +75,10 @@ export default { this.loadNotifications(); }, todayNotifications() { - let startOfDay = (new Date()).setUTCHours(0, 0, 0, 0); - return this.notifications.filter(n => moment(n.created_at) >= startOfDay); + return this.notifications.filter(n => n.today); }, olderNotifications() { - let startOfDay = (new Date()).setUTCHours(0, 0, 0, 0); - return this.notifications.filter(n => moment(n.created_at) < startOfDay); + return this.notifications.filter(n => !n.today); } }, methods: {