1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-07 22:02:22 +01:00

Datetime date initial value fix (#6483)

This commit is contained in:
RFDarter
2024-04-08 09:36:23 +02:00
committed by GitHub
parent 6f71363d9b
commit d6352b3be4
2 changed files with 11 additions and 2 deletions

View File

@@ -914,7 +914,7 @@ void WebServer::handle_date_request(AsyncWebServerRequest *request, const UrlMat
std::string WebServer::date_json(datetime::DateEntity *obj, JsonDetail start_config) {
return json::build_json([obj, start_config](JsonObject root) {
set_json_id(root, obj, "date-" + obj->get_object_id(), start_config);
std::string value = str_sprintf("%d-%d-%d", obj->year, obj->month, obj->day);
std::string value = str_sprintf("%d-%02d-%02d", obj->year, obj->month, obj->day);
root["value"] = value;
root["state"] = value;
});