}
const wxChar * const clsname = s_clsMonthCal.IsRegistered()
- ? s_clsMonthCal.GetName().wx_str()
+ ? s_clsMonthCal.GetName().t_str()
: MONTHCAL_CLASS;
if ( !MSWCreateControl(clsname, wxEmptyString, pos, size) )
wxDateTime startDate;
startDate.SetFromMSWSysDate(ds->stStart);
- wxDateTime currentDate = m_date;
+ // Ensure we have a valid date to work with.
+ wxDateTime currentDate = m_date.IsValid() ? m_date : startDate;
+
// Set to the start of month for comparison with startDate to
// work correctly.
currentDate.SetDay(1);