mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +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
|
@ -152,18 +152,6 @@ void guess (
|
|||
guess (type, options, candidate);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool validDate (std::string& date)
|
||||
{
|
||||
Date test (date, context.config.get ("dateformat", "m/d/Y"));
|
||||
|
||||
char epoch[16];
|
||||
sprintf (epoch, "%d", (int) test.toEpoch ());
|
||||
date = epoch;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool validPriority (const std::string& input)
|
||||
{
|
||||
|
@ -207,10 +195,10 @@ bool validAttribute (std::string& name, std::string& value)
|
|||
guess ("color", colors, value);
|
||||
|
||||
else if (name == "due" && value != "")
|
||||
validDate (value);
|
||||
Date (value);
|
||||
|
||||
else if (name == "until" && value != "")
|
||||
validDate (value);
|
||||
Date (value);
|
||||
|
||||
else if (name == "priority")
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue