1
0
mirror of https://github.com/beestat/app.git synced 2025-07-09 03:04:07 -04:00

Fixed #199 - Runtime Detail max range error when selecting 30 days

Increased the API limit to 31 days and left the GUI limit at 30 days. There are some edge cases where a few extra seconds can get added.
This commit is contained in:
Jon Ziebell 2019-12-17 21:06:58 -05:00
parent fed0ff43d6
commit 65d2de264c

View File

@ -601,7 +601,7 @@ class runtime_thermostat extends cora\crud {
} }
$thermostat = $this->api('thermostat', 'get', $attributes['thermostat_id']); $thermostat = $this->api('thermostat', 'get', $attributes['thermostat_id']);
$max_range = 2592000; // 30 days $max_range = 2678000; // 31 days
if ( if (
( (
is_array($attributes['timestamp']) === true && is_array($attributes['timestamp']) === true &&
@ -619,7 +619,7 @@ class runtime_thermostat extends cora\crud {
strtotime($attributes['timestamp']['value']) - min(strtotime($thermostat['first_connected']), strtotime($thermostat['sync_begin'])) > $max_range strtotime($attributes['timestamp']['value']) - min(strtotime($thermostat['first_connected']), strtotime($thermostat['sync_begin'])) > $max_range
) )
) { ) {
throw new \Exception('Max range is 30 days.', 10205); throw new \Exception('Max range is 31 days. ' . (time() - strtotime($attributes['timestamp']['value'])), 10205);
} }
// Accept timestamps in roughly any format; always convert back to something nice and in UTC // Accept timestamps in roughly any format; always convert back to something nice and in UTC