fix timestamp maybe?

This commit is contained in:
Christopher Cookman 2024-10-28 22:48:51 -06:00
parent 0b1a96648f
commit 16014d6623

View file

@ -102,13 +102,18 @@ function updateRecords(data, root) {
return data;
}
function getStartOfDayTimestamp(date) {
const startOfDay = new Date(date.getFullYear(), date.getMonth(), date.getDate());
return startOfDay.getTime(); // Returns the timestamp in milliseconds
}
async function sendSummary() {
const data = await getPreviousDayData();
const root = await loadRecords();
const updatedData = await updateRecords(data, root);
await saveRecords(root);
const previousDayStart = new Date(Date.now() - 86400000);
const previousDayStart = new Date(getStartOfDayTimestamp(new Date()));
const previousDayEnd = new Date(previousDayStart);
previousDayEnd.setHours(23, 59, 59, 999);