also use proper date in tasks

merge-requests/208/head
fatchan 4 years ago
parent a426c8542e
commit 21b4e8cf23
  1. 10
      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);

Loading…
Cancel
Save