fix update
This commit is contained in:
@@ -2,7 +2,7 @@ import { statusItem } from "glimpseui";
|
||||
import refresh from "./handlers/refresh.mjs";
|
||||
import { base } from "./helpers/html.mjs";
|
||||
import { log } from "./helpers/logger.mjs";
|
||||
import { differenceInDays } from "date-fns";
|
||||
import { isToday } from "date-fns";
|
||||
import open from "open";
|
||||
|
||||
let lastDate = new Date();
|
||||
@@ -20,10 +20,9 @@ app.on("message", (message) => {
|
||||
case "ready":
|
||||
interval = setInterval(() => {
|
||||
log("Checking for new reading...");
|
||||
const now = new Date();
|
||||
if (Math.abs(differenceInDays(now, lastDate)) >= 1) {
|
||||
if (!isToday(lastDate)) {
|
||||
refresh(app);
|
||||
lastDate = now;
|
||||
lastDate = new Date();
|
||||
log("Updated reading for date:", lastDate);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user