From 301c66eebacb230a8128ff50bc9b569c64aaaf6b Mon Sep 17 00:00:00 2001 From: Brian McGonagill Date: Wed, 7 Sep 2022 11:30:38 -0500 Subject: [PATCH] Fixing the menu items to sort by date. --- client/MenuItems/menuItemsTbl.js | 2 +- imports/api/menuItems.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/client/MenuItems/menuItemsTbl.js b/client/MenuItems/menuItemsTbl.js index 29ede86..dd07129 100644 --- a/client/MenuItems/menuItemsTbl.js +++ b/client/MenuItems/menuItemsTbl.js @@ -12,7 +12,7 @@ Template.menuItemsTbl.onRendered(function() { Template.menuItemsTbl.helpers({ thisMenuItems: function() { - return MenuItems.find({}); + return MenuItems.find({}, { sort: { serveDateActual: 1 }}); } }); diff --git a/imports/api/menuItems.js b/imports/api/menuItems.js index 339eaf9..7a5209d 100644 --- a/imports/api/menuItems.js +++ b/imports/api/menuItems.js @@ -21,10 +21,12 @@ Meteor.methods({ throw new Meteor.Error('You are not allowed to add items. Make sure you are logged in with valid user credentials.'); } + serveDateActual = new Date(serveDate); return MenuItems.insert({ itemName: itemName, serveDate: serveDate, + serveDateActual: serveDateActual, menuId: menuId, addedBy: this.userId, itemMade: false,