mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-08-02 05:30:23 +02:00
Enhancements - date
- Relocated valid.cpp/dataValid to Date::valid. - Added new unit tests in date.t.cpp.
This commit is contained in:
parent
d99dec5556
commit
0665caae55
5 changed files with 23 additions and 16 deletions
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)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue