Fixes parsing when using mxDateTime, patch from Will Sadkin
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20770 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -573,8 +573,13 @@ class wxTimeCtrl(wxMaskedTextCtrl):
|
||||
|
||||
def GetMxDateTime(self, value=None):
|
||||
if value is None:
|
||||
value = self.GetValue()
|
||||
t = DateTime.DateTime(1970,1,1) + DateTime.Parser.TimeFromString(value)
|
||||
t = self.GetValue(as_mxDateTime=True)
|
||||
else:
|
||||
# Convert string 1st to wxDateTime, then use components, since
|
||||
# mx' DateTime.Parser.TimeFromString() doesn't handle AM/PM:
|
||||
wxdt = self.GetWxDateTime(value)
|
||||
hour, minute, second = wxdt.GetHour(), wxdt.GetMinute(), wxdt.GetSecond()
|
||||
t = DateTime.DateTime(1970,1,1) + DateTimeDelta(0, hour, minute, second)
|
||||
return t
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user