Add time zone parsing support for 'Z' (UTC indicator)
This commit is contained in:
committed by
Dimitri Schoolwerth
parent
51cfb64ecb
commit
a3a4e7c638
@@ -1482,6 +1482,14 @@ wxDateTime::ParseFormat(const wxString& date,
|
|||||||
if ( input == end )
|
if ( input == end )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if ( *input == wxS('Z') )
|
||||||
|
{
|
||||||
|
// Time is in UTC.
|
||||||
|
++input;
|
||||||
|
haveTimeZone = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// and then check that it's either plus or minus sign
|
// and then check that it's either plus or minus sign
|
||||||
bool minusFound;
|
bool minusFound;
|
||||||
if ( *input == wxT('-') )
|
if ( *input == wxT('-') )
|
||||||
|
@@ -903,6 +903,9 @@ void DateTimeTestCase::TestTimeZoneParse()
|
|||||||
{ "13:37+0000", true },
|
{ "13:37+0000", true },
|
||||||
{ "17:37+0400", true },
|
{ "17:37+0400", true },
|
||||||
|
|
||||||
|
// Z as UTC designator.
|
||||||
|
{ "13:37Z", true },
|
||||||
|
|
||||||
// Some invalid ones too.
|
// Some invalid ones too.
|
||||||
{ "00:00-1300" }, // Offset out of range.
|
{ "00:00-1300" }, // Offset out of range.
|
||||||
{ "00:00+1300" }, // Offset out of range.
|
{ "00:00+1300" }, // Offset out of range.
|
||||||
|
Reference in New Issue
Block a user