mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-06-26 10:54:26 +02:00
Bug #831
- Fixed bug #831 that imposed an arbitrary and incorrect assumption that caused some date fields from being parsed properly.
This commit is contained in:
parent
4901089408
commit
965e15fe91
2 changed files with 6 additions and 6 deletions
|
@ -185,6 +185,7 @@
|
|||
(thanks to Owen Clarke).
|
||||
+ Fixed bug #808, which generated compiler warnings on Solarix (thanks to
|
||||
Owen Clarke).
|
||||
+ Fixed bug #831, which prevented some date fields from being properly parsed.
|
||||
|
||||
# Untracked Bugs, biggest first.
|
||||
+ Fixed bug that required the '%YAML' prologue in a YAML import.
|
||||
|
|
11
src/Date.cpp
11
src/Date.cpp
|
@ -128,10 +128,6 @@ Date::Date (const int m, const int d, const int y,
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
Date::Date (const std::string& input, const std::string& format /* = "m/d/Y" */)
|
||||
{
|
||||
// Perhaps it is an epoch date, in string form?
|
||||
if (isEpoch (input))
|
||||
return;
|
||||
|
||||
// Before parsing according to "format", perhaps this is a relative date?
|
||||
if (isRelativeDate (input))
|
||||
return;
|
||||
|
@ -145,6 +141,10 @@ Date::Date (const std::string& input, const std::string& format /* = "m/d/Y" */)
|
|||
if (n.getDate (format, _t) && n.depleted ())
|
||||
return;
|
||||
|
||||
// Perhaps it is an epoch date, in string form?
|
||||
if (isEpoch (input))
|
||||
return;
|
||||
|
||||
throw ::format (STRING_DATE_INVALID_FORMAT, input, format);
|
||||
}
|
||||
|
||||
|
@ -771,8 +771,7 @@ void Date::operator++ (int)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
bool Date::isEpoch (const std::string& input)
|
||||
{
|
||||
if (digitsOnly (input) &&
|
||||
input.length () > 8 &&
|
||||
if (digitsOnly (input) &&
|
||||
input.length () <= 10 )
|
||||
{
|
||||
_t = (time_t) atoi (input.c_str ());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue