diff --git a/clock.js b/clock.js index b4582fe..63e2301 100644 --- a/clock.js +++ b/clock.js @@ -14,7 +14,7 @@ module.exports = RED => { this.on( 'close', ui.addWidget( { node: this, format: ` - + @@ -77,6 +77,11 @@ module.exports = RED => { beforeEmit: msg => ( { msg } ), initController: $scope => $scope.$watch( 'msg.payload', payload => { const total_seconds = +payload || 0; + const maxtime = 999 * 3600 + 59 * 60 + 59; + + if (total_seconds < 0) total_seconds = 0; + else if (total_seconds > maxtime) total_seconds = maxtime; + let remaining_seconds = total_seconds; let hours = Math.floor(remaining_seconds / 3600.0);