Make date formats match and stop passing an extra variable.

This commit is contained in:
mattbk 2023-09-06 16:57:57 -05:00
parent fd61efebba
commit c174d7f594
2 changed files with 11 additions and 6 deletions

View File

@ -10,8 +10,8 @@
[env:esp32doit-devkit-v1]
platform = espressif32
;build_flags =
; -std=c++11
build_flags =
-std=c++11
; -std=gnu++11
board = esp32doit-devkit-v1
framework = arduino

View File

@ -79,11 +79,14 @@ const char index_html[] PROGMEM = R"rawliteral(
current_start = new Date(s * 1000);
//current_start_utc = current_start.toUTCString();
document.getElementById('current-start').innerHTML = current_start.toString();
// Show the local time
local_time_unix = new Date().toString(); //Math.floor(Date.now() / 1000) - new Date().getTimezoneOffset()*60;
document.getElementById('local-time-unix').innerHTML = local_time_unix.toString();
}
</script></head><body>
<p>Local time: <b>%inputTimeUnix%</b></p>
<p>Local time: <b><span id=local-time-unix></span></b></p>
<form action="/get" target="hidden-form" onsubmit="putDate(this);" accept-charset=utf-8>
@ -105,7 +108,7 @@ const char index_html[] PROGMEM = R"rawliteral(
</select></p>
<p>Program start time <input type="datetime-local" id="js_start_time_unix_entry" /><br>
Current value: <b><span id = current-start></span></b>)
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>
@ -209,8 +212,10 @@ String processor(const String& var){
}
else if(var == "inputFloat"){
return readFile(SPIFFS, "/inputFloat.txt");
} else if(var == "inputTimeUnix"){
return rtc.now().timestamp();
// } else if(var == "inputTimeUnix"){
// //return rtc.now().timestamp();
// Serial.print("RTC time: ");
// Serial.println(rtc.now().unixtime());
} else if(var == "inputStartTimeUnix"){
return readFile(SPIFFS, "/inputStartTimeUnix.txt");
}