trantor
trantor copied to clipboard
Date::fromDbStringLocal() fails if time is missing
Description
The function trantor::Date::fromDbStringLocal() expects a full timestamp string in the format: "YYYY-MM-DD HH:MM:SS[.ffffff]", but if you pass only a date string like "1970-01-01", it fails silently and returns an invalid Date object, which can lead to confusing behavior.
Example
std::string s = trantor::Date().toDbStringLocal(); // "1970-01-01"
auto d = trantor::Date::fromDbStringLocal(s);
LOG_DEBUG << d.toDbStringLocal(); // Outputs: 1899-00--1
Expected Behavior
The parser should either support "YYYY-MM-DD" as a valid input by assuming zero time