Skip to content

Commit 473bf7c

Browse files
committed
Fixed time-of-day rules for real
1 parent 94de296 commit 473bf7c

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/electron.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1042,17 +1042,18 @@ function handleBackgroundUpdate() {
10421042
// Check if event is not later than current time, last event time, or last found time
10431043
if (hour >= eventHour || (hour == eventHour && minute >= eventMinute)) {
10441044
// Check if found event is greater than last found event
1045-
if(foundEvent === false || foundEvent.hour < eventHour || !(foundEvent.hour == eventHour && foundEvent.minute > eventMinute)) {
1046-
foundEvent = Object.assign(event, {})
1045+
if(foundEvent === false || foundEvent.hour < eventHour || (foundEvent.hour == eventHour && foundEvent.minute <= eventMinute)) {
1046+
foundEvent = Object.assign({}, event)
10471047
foundEvent.minute = eventMinute
10481048
foundEvent.hour = eventHour
1049+
console.log(foundEvent)
10491050
}
10501051
}
10511052
}
10521053
if (foundEvent) {
10531054
if (lastTimeEvent == false || lastTimeEvent.hour < foundEvent.hour || (lastTimeEvent.hour == foundEvent.hour && lastTimeEvent.minute < foundEvent.minute) ) {
10541055
console.log("Adjusting brightness automatically", foundEvent)
1055-
lastTimeEvent = foundEvent
1056+
lastTimeEvent = Object.assign({}, foundEvent)
10561057
lastTimeEvent.day = new Date().getDate()
10571058
refreshMonitors().then(() => {
10581059
transitionBrightness(foundEvent.brightness, (foundEvent.monitors ? foundEvent.monitors : {}))

0 commit comments

Comments
 (0)