Set up scheduled program cycles #24
|
@ -66,9 +66,8 @@ const char index_html[] PROGMEM = R"rawliteral(
|
|||
<script>
|
||||
// Submit timestamps as unix seconds
|
||||
var putDate = function(form) {
|
||||
form.inputTimeUnix.value = Math.floor(Date.now() / 1000);
|
||||
//offset_secs = new Date().getTimezoneOffset()*60;
|
||||
document.getElementById("js_start_time_unix").value = ((Date.parse(js_start_time_unix_entry.value))/1000) - new Date().getTimezoneOffset()*60;
|
||||
form.inputTimeUnix.value = Math.floor(Date.now() / 1000) - new Date().getTimezoneOffset()*60;
|
||||
document.getElementById("js_start_time_unix").value = ((Date.parse(js_start_time_unix_entry.value))/1000);
|
||||
};
|
||||
// Refresh page after submit so values are right https://stackoverflow.com/a/1860732/2152245
|
||||
window.onload = function() {
|
||||
|
@ -78,11 +77,14 @@ const char index_html[] PROGMEM = R"rawliteral(
|
|||
// Current start date to string
|
||||
s = %inputStartTimeUnix%;
|
||||
current_start = new Date(s * 1000);
|
||||
current_start_utc = current_start.toUTCString();
|
||||
document.getElementById('current-start').innerHTML = current_start_utc;
|
||||
//current_start_utc = current_start.toUTCString();
|
||||
document.getElementById('current-start').innerHTML = current_start.toString();
|
||||
}
|
||||
|
||||
</script></head><body>
|
||||
|
||||
<p>Local time: <b>%inputTimeUnix%</b></p>
|
||||
|
||||
<form action="/get" target="hidden-form" onsubmit="putDate(this);" accept-charset=utf-8>
|
||||
|
||||
<p>Sending program (cycle doesn't work yet) (current value: <b>%inputSend%</b>):
|
||||
|
@ -102,9 +104,8 @@ const char index_html[] PROGMEM = R"rawliteral(
|
|||
<option value="5">5 - MO5</option>
|
||||
</select></p>
|
||||
|
||||
<p>Current time (UTC): <b>%inputTimeUnix%</b><br>
|
||||
|
||||
Program start time (current value <b><span id = current-start></span></b>): <input type="datetime-local" id="js_start_time_unix_entry" />
|
||||
<p>Program start time <input type="datetime-local" id="js_start_time_unix_entry" /><br>
|
||||
Current value: <b><span id = current-start></span></b>)
|
||||
<!-- JS converts the entered start time to a unix timestamp, and copies that value
|
||||
to this hidden field so the user doesn't have to see it. -->
|
||||
<input type="hidden" name="inputStartTimeUnix" id="js_start_time_unix" /></p>
|
||||
|
|
Loading…
Reference in New Issue
Block a user