Let wxVariantDataDateTime::Write() and Read() work with invalid dates (otherwise wxVariant::GetString() will assert when value is an invalid wxDateTime)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@58054 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1223,7 +1223,11 @@ bool wxVariantDataDateTime::Write(wxSTD ostream& str) const
|
||||
|
||||
bool wxVariantDataDateTime::Write(wxString& str) const
|
||||
{
|
||||
if ( m_value.IsValid() )
|
||||
str = m_value.Format();
|
||||
else
|
||||
str = wxT("Invalid");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1239,6 +1243,12 @@ bool wxVariantDataDateTime::Read(wxSTD istream& WXUNUSED(str))
|
||||
|
||||
bool wxVariantDataDateTime::Read(wxString& str)
|
||||
{
|
||||
if ( str == wxT("Invalid") )
|
||||
{
|
||||
m_value = wxInvalidDateTime;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(! m_value.ParseDateTime(str))
|
||||
return false;
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user