Enhancements - date
- Relocated valid.cpp/dataValid to Date::valid. - Added new unit tests in date.t.cpp.
This commit is contained in:
16
src/Date.cpp
16
src/Date.cpp
@@ -254,6 +254,22 @@ const std::string Date::toString (const std::string& format /*= "m/d/Y" */) cons
|
||||
return formatted;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Date::valid (const std::string& input, const std::string& format)
|
||||
{
|
||||
try
|
||||
{
|
||||
Date test (input, format);
|
||||
}
|
||||
|
||||
catch (...)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Date::valid (const int m, const int d, const int y)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user