Skip to content

Commit

Permalink
fix: schedulers are not created in Jan 1
Browse files Browse the repository at this point in the history
  • Loading branch information
LeivoSepp committed Dec 31, 2023
1 parent adc45ff commit d5a9efd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions SmartHeatingWidthShelly.js
Original file line number Diff line number Diff line change
Expand Up @@ -595,8 +595,10 @@ Getting prices or forecast for today if
function isUpdtReq(ts) {
let nextHour = nextChkHr();
let now = new Date();
let isToday = new Date(ts * 1000).getDate() === now.getDate();
let isYesterday = new Date(ts * 1000).getDate() === new Date(now - _.dayInSec * 1000).getDate();
let yestDt = new Date(now - _.dayInSec * 1000);
let tsDt = new Date(ts * 1000);
let isToday = tsDt.getFullYear() === now.getFullYear() && tsDt.getMonth() === now.getMonth() && tsDt.getDate() === now.getDate();
let isYesterday = tsDt.getFullYear() === yestDt.getFullYear() && tsDt.getMonth() === yestDt.getMonth() && tsDt.getDate() === yestDt.getDate();
let isTsAfterChkT = new Date(ts * 1000).getHours() === nextHour;
let isChkT = now.getHours() === nextHour;
return (isChkT && !isTsAfterChkT) || !(isToday || isYesterday);
Expand Down

0 comments on commit d5a9efd

Please sign in to comment.