Skip to content

Commit

Permalink
Fix initial startup issue with missing start / stop times (#38)
Browse files Browse the repository at this point in the history
* Fix initial startup issue with missing start / stop times

* Update package.json

---------

Co-authored-by: Thomas Bowman Mørch <thomas.git@bowmo.dk>
  • Loading branch information
tbowmo and Thomas Bowman Mørch authored Aug 30, 2024
1 parent e8b00d1 commit c6ea187
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": {
"name": "Thomas Bowman Mørch"
},
"version": "0.17.0",
"version": "0.18.0",
"engines": {
"node": ">=14.0.0"
},
Expand Down
36 changes: 31 additions & 5 deletions src/nodes/small-timer.html
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,28 @@ <h3>References</h3>
generateTimes('#node-input-startTime', sunCalcTimes, false)
generateTimes('#node-input-endTime', sunCalcTimes, true)
})
.fail(() => {
const sunCalcTimes = [
{"id":"5101","label":"Sunrise"},
{"id":"5102","label":"Sunrise end"},
{"id":"5103","label":"Golden hour end"},
{"id":"5104","label":"Solar noon"},
{"id":"5105","label":"Golden hour"},
{"id":"5106","label":"Sunset start"},
{"id":"5107","label":"Sunset"},
{"id":"5108","label":"Dusk"},
{"id":"5109","label":"Nautical dusk"},
{"id":"5110","label":"Night"},
{"id":"5111","label":"Nadir"},
{"id":"5112","label":"Night end"},
{"id":"5113","label":"Nautical dawn"},
{"id":"5114","label":"Dawn"},
{"id":"5115","label":"Moonrise"},
{"id":"5116","label":"Moonset"}
]
generateTimes('#node-input-startTime', sunCalcTimes, false)
generateTimes('#node-input-endTime', sunCalcTimes, true)
})

offsetEnable($('#node-input-startTime').val(), '#node-input-startOffset')
offsetEnable($('#node-input-endTime').val(), '#node-input-endOffset')
Expand Down Expand Up @@ -565,11 +587,15 @@ <h3>References</h3>
`
let sunCalc = ''
for (const item of sunMoon) {
const time = new Date(item.date)
const hour = leadingZero(time.getHours())
const minute = leadingZero(time.getMinutes())
const tString = `${hour}:${minute}`
sunCalc += `<option value="${item.id}">${tString} - ${item.label}</option>`
if (item.date) {
const time = new Date(item.date)
const hour = leadingZero(time.getHours())
const minute = leadingZero(time.getMinutes())
const tString = `${hour}:${minute}`
sunCalc += `<option value="${item.id}">${tString} - ${item.label}</option>`
} else {
sunCalc += `<option value="${item.id}">${item.label}</option>`
}
}

html += `
Expand Down

0 comments on commit c6ea187

Please sign in to comment.