ISO8601d: Fixed parsing of day and month name
This commit is contained in:
@@ -512,15 +512,16 @@ bool ISO8601d::parse_formatted (Nibbler& n, const std::string& format)
|
|||||||
|
|
||||||
case 'A':
|
case 'A':
|
||||||
{
|
{
|
||||||
auto cursor = n.cursor ();
|
std::string dayName;
|
||||||
wday = ISO8601d::dayOfWeek (n.str ().substr (cursor));
|
if (n.getUntil (format[f + 1], dayName))
|
||||||
|
{
|
||||||
|
wday = ISO8601d::dayOfWeek (lowerCase (dayName));
|
||||||
if (wday == -1)
|
if (wday == -1)
|
||||||
{
|
{
|
||||||
n.restore ();
|
n.restore ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
n.skipN (ISO8601d::dayName (wday).size ());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -540,15 +541,16 @@ bool ISO8601d::parse_formatted (Nibbler& n, const std::string& format)
|
|||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
{
|
{
|
||||||
auto cursor = n.cursor ();
|
std::string monthName;
|
||||||
month = ISO8601d::dayOfWeek (n.str ().substr (cursor));
|
if (n.getUntil (format[f + 1], monthName))
|
||||||
|
{
|
||||||
|
month = ISO8601d::monthOfYear (lowerCase (monthName));
|
||||||
if (month == -1)
|
if (month == -1)
|
||||||
{
|
{
|
||||||
n.restore ();
|
n.restore ();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
n.skipN (ISO8601d::monthName (month).size ());
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user