mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
Date
- Made the buffer depletion requirement optional for dateformat and ISO date parsing.
This commit is contained in:
parent
5150e49f67
commit
ecb6adbbeb
2 changed files with 7 additions and 6 deletions
|
@ -131,7 +131,8 @@ Date::Date (
|
|||
const std::string& input,
|
||||
const std::string& format /* = "m/d/Y" */,
|
||||
const bool iso /* = true */,
|
||||
const bool epoch /* = true */)
|
||||
const bool epoch /* = true */,
|
||||
const bool require_depletion /* = true */)
|
||||
{
|
||||
// Check first to see if this is supported as a named date.
|
||||
Variant v;
|
||||
|
@ -145,13 +146,13 @@ Date::Date (
|
|||
Nibbler n (input);
|
||||
n.save ();
|
||||
#ifdef NIBBLER_FEATURE_DATE
|
||||
if (n.getDate (format, _t) && n.depleted ())
|
||||
if (n.getDate (format, _t) && (!require_depletion || n.depleted ()))
|
||||
return;
|
||||
#endif
|
||||
|
||||
// Parse an ISO date.
|
||||
n.restore ();
|
||||
if (iso && n.getDateISO (_t) && n.depleted ())
|
||||
if (iso && n.getDateISO (_t) && (!require_depletion || n.depleted ()))
|
||||
return;
|
||||
|
||||
// Perhaps it is an epoch date, in string form?
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
Date (time_t);
|
||||
Date (const int, const int, const int);
|
||||
Date (const int, const int, const int, const int, const int, const int);
|
||||
Date (const std::string&, const std::string& format = "m/d/Y", const bool iso = true, const bool epoch = true);
|
||||
Date (const std::string&, const std::string& format = "m/d/Y", const bool iso = true, const bool epoch = true, const bool require_depletion = true);
|
||||
Date (const Date&);
|
||||
virtual ~Date ();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue