X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2995b6881211ea19c629497d50dd31028f2fbd17..e1efca652844273c3e8d32c7e5f442b87e455ca7:/samples/widgets/datepick.cpp diff --git a/samples/widgets/datepick.cpp b/samples/widgets/datepick.cpp index 4295abc9c2..1ce550538b 100644 --- a/samples/widgets/datepick.cpp +++ b/samples/widgets/datepick.cpp @@ -6,7 +6,7 @@ // Created: 27 Sep 2003 // Id: $Id$ // Copyright: (c) 2003 wxWindows team -// License: wxWindows license +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================ @@ -185,9 +185,9 @@ void DatePickerWidgetsPage::Reset() const wxDateTime today = wxDateTime::Today(); m_datePicker->SetValue(today); - m_day->SetValue(wxString::Format(_T("%d"), today.GetDay())); - m_month->SetValue(wxString::Format(_T("%d"), today.GetMonth())); - m_year->SetValue(wxString::Format(_T("%d"), today.GetYear())); + m_day->SetValue(wxString::Format(wxT("%d"), today.GetDay())); + m_month->SetValue(wxString::Format(wxT("%d"), today.GetMonth() + 1)); + m_year->SetValue(wxString::Format(wxT("%d"), today.GetYear())); } void DatePickerWidgetsPage::CreateDatePicker() @@ -223,24 +223,26 @@ void DatePickerWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) void DatePickerWidgetsPage::OnButtonSet(wxCommandEvent& WXUNUSED(event)) { - long day, month, year; + long day = 0, + month = 0, + year = 0; if ( m_day->GetValue().ToLong(&day) && m_month->GetValue().ToLong(&month) && m_year->GetValue().ToLong(&year) ) { - const wxDateTime someDay(day, wxDateTime::Month(month), year); + const wxDateTime someDay(day, wxDateTime::Month(month - 1), year); if ( someDay.IsValid() ) { m_datePicker->SetValue(someDay); } else { - wxLogError(_T("Date is invalid")); + wxLogError(wxT("Date is invalid")); } } else { - wxLogError(_T("One of inputs is not number")); + wxLogError(wxT("One of inputs is not number")); } }