+ if ( dt.IsValid() )
+ {
+ GetDateTimePeer()->SetDateTime(dt);
+ }
+ else // invalid date
+ {
+ wxASSERT_MSG( HasFlag(wxDP_ALLOWNONE),
+ wxT("this control must have a valid date") );
+
+ // TODO setting to an invalid date is not natively supported
+ // so we must implement a UI for that ourselves
+ GetDateTimePeer()->SetDateTime(dt);
+ }