As part of input validation, I'm using std::get_time() to validate the input date that is coming in to my application.
I'm assuming below logic should set fail bit due to incorrect format but that doesn't. So, what could be the problem?
I'm using Visual studio 2019.
This is the sample code.
int main() {
std::tm timeInfo;
std::memset(&timeInfo, 0, sizeof(timeInfo));
timeInfo.tm_isdst = -1;
std::istringstream ss("2021/12/31");
ss >> std::get_time(&timeInfo, "%m/%d/%Y");
if (ss.fail() == true)
cout << "fail bit is set"<<endl;
return 0;
}

