Enhancements - date

- Relocated valid.cpp/dataValid to Date::valid.
- Added new unit tests in date.t.cpp.
This commit is contained in:
Paul Beckingham 2009-06-13 12:51:51 -04:00
parent d99dec5556
commit 0665caae55
5 changed files with 23 additions and 16 deletions

View file

@ -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)
{