]> ToastFreeware Gitweb - chrisu/seepark.git/blobdiff - web/static/seepark_web.js
fix updating current air/water: strftime expects a "new Date"
[chrisu/seepark.git] / web / static / seepark_web.js
index 2aad39b6c1505f9796decbad2abb53d85c46c241..fdc5377087f223bf257cd134ed73471d2f22a8db 100644 (file)
@@ -220,19 +220,19 @@ setInterval(
                        .then((resp) => resp.json())
                        .then(function(data) {
                                airvalue.innerText = data['value'].toFixed(1);
-                               airtime.innerText  = strftime('%Y-%m-%d H:%M', data['timestamp']);
+                               airtime.innerText  = strftime('%Y-%m-%d H:%M', new Date(data['timestamp']));
                        })
                        .catch(function(error) {
-                               // handle error
+                               console.log(error);
                        });
                fetch(api_url_currentwater)
                        .then((resp) => resp.json())
                        .then(function(data) {
                                watervalue.innerText = data['value'].toFixed(1);
-                               watertime.innerText  = strftime('%Y-%m-%d H:%M', data['timestamp']);
+                               watertime.innerText  = strftime('%Y-%m-%d H:%M', new Date(data['timestamp']));
                        })
                        .catch(function(error) {
-                               // handle error
+                               console.log(error);
                        });
        },
        refresh_interval