From 21b4e8cf236e8b56e2f48b864898f5580210306a Mon Sep 17 00:00:00 2001 From: fatchan Date: Mon, 17 Feb 2020 16:07:51 +1100 Subject: [PATCH] also use proper date in tasks --- helpers/tasks.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/helpers/tasks.js b/helpers/tasks.js index 61690695..3eb451b4 100644 --- a/helpers/tasks.js +++ b/helpers/tasks.js @@ -136,10 +136,12 @@ module.exports = { buildModLog: async (options) => { if (!options.startDate || !options.endDate) { - options.startDate = new Date(); //this is being built by action handler so will always be current date - options.endDate = new Date(options.startDate.getTime()); - options.startDate.setHours(0,0,0,0); - options.endDate.setHours(23,59,59,999); + const d = new Date(); + const month = d.getUTCMonth() + , day = d.getUTCDate() + , year = d.getUTCFullYear(); + options.startDate = new Date(Date.UTC(year, month, day, 0, 0, 0, 0)); + options.endDate = new Date(Date.UTC(year, month, day, 23, 59, 59, 999)); } const day = ('0'+options.startDate.getDate()).slice(-2); const month = ('0'+(options.startDate.getMonth()+1)).slice(-2);