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/trunk@58053 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1242,7 +1242,10 @@ bool wxVariantDataDateTime::Write(wxSTD ostream& str) const
|
||||
|
||||
bool wxVariantDataDateTime::Write(wxString& str) const
|
||||
{
|
||||
str = m_value.Format();
|
||||
if ( m_value.IsValid() )
|
||||
str = m_value.Format();
|
||||
else
|
||||
str = wxS("Invalid");
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1258,6 +1261,12 @@ bool wxVariantDataDateTime::Read(wxSTD istream& WXUNUSED(str))
|
||||
|
||||
bool wxVariantDataDateTime::Read(wxString& str)
|
||||
{
|
||||
if ( str == wxS("Invalid") )
|
||||
{
|
||||
m_value = wxInvalidDateTime;
|
||||
return true;
|
||||
}
|
||||
|
||||
if(! m_value.ParseDateTime(str.c_str()/*FIXME-UTF8*/))
|
||||
return false;
|
||||
return true;
|
||||
|
Reference in New Issue
Block a user