Date/ISO8601
- Changed the order of parsing from ISO, Date to Date, ISO. This favors the old dateformat mechanism more than the new one. One day this will flip.
This commit is contained in:
@@ -130,7 +130,7 @@ bool Lexer::token (std::string& result, Type& type)
|
||||
space = _input.length ();
|
||||
|
||||
std::string legacy = _input.substr (start, space - start);
|
||||
Date legacyDate (legacy, Lexer::dateFormat, false, false);
|
||||
Date legacyDate (legacy, Lexer::dateFormat, true, false);
|
||||
|
||||
space -= start;
|
||||
while (space--) shift ();
|
||||
|
||||
@@ -1577,13 +1577,13 @@ void Task::validate (bool applyDefault /* = true */)
|
||||
{
|
||||
std::string value = get ("recur");
|
||||
|
||||
ISO8601p p;
|
||||
Duration d;
|
||||
std::string::size_type i = 0;
|
||||
if (! p.parse (value, i))
|
||||
if (! d.parse (value, i))
|
||||
{
|
||||
i = 0;
|
||||
Duration d;
|
||||
if (! d.parse (value, i))
|
||||
ISO8601p p;
|
||||
if (! p.parse (value, i))
|
||||
throw std::string (format (STRING_TASK_VALID_RECUR, value));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1678,22 +1678,22 @@ void Variant::cast (const enum type new_type)
|
||||
case type_duration:
|
||||
{
|
||||
_duration = 0;
|
||||
ISO8601p iso;
|
||||
std::string::size_type pos = 0;
|
||||
if (iso.parse (_string, pos) &&
|
||||
pos == _string.length ())
|
||||
{
|
||||
_duration = (time_t) iso;
|
||||
}
|
||||
else
|
||||
{
|
||||
Duration dur;
|
||||
pos = 0;
|
||||
std::string::size_type pos = 0;
|
||||
if (dur.parse (_string, pos) &&
|
||||
pos == _string.length ())
|
||||
{
|
||||
_duration = (time_t) dur;
|
||||
}
|
||||
else
|
||||
{
|
||||
ISO8601p iso;
|
||||
pos = 0;
|
||||
if (iso.parse (_string, pos) &&
|
||||
pos == _string.length ())
|
||||
{
|
||||
_duration = (time_t) iso;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user