Author: axeld Date: 2011-03-31 23:35:53 +0200 (Thu, 31 Mar 2011) New Revision: 41155 Changeset: https://dev.haiku-os.org/changeset/41155 Ticket: https://dev.haiku-os.org/ticket/7421 Modified: haiku/trunk/src/kits/shared/CalendarView.cpp Log: * The last month was computed by setting a possibly invalid date (ie. the February only has 28 to 29 days, so setting the current day may fail). * This caused bug #7421. Modified: haiku/trunk/src/kits/shared/CalendarView.cpp =================================================================== --- haiku/trunk/src/kits/shared/CalendarView.cpp 2011-03-31 18:09:55 UTC (rev 41154) +++ haiku/trunk/src/kits/shared/CalendarView.cpp 2011-03-31 21:35:53 UTC (rev 41155) @@ -1,5 +1,5 @@ /* - * Copyright 2007-2009, Haiku, Inc. All Rights Reserved. + * Copyright 2007-2011, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -16,9 +16,8 @@ namespace BPrivate { -namespace { -float +static float FontHeight(const BView *view) { if (!view) @@ -31,9 +30,10 @@ return ceilf(fheight.ascent + fheight.descent + fheight.leading); } -} // private namespace +// #pragma mark - + BCalendarView::BCalendarView(BRect frame, const char *name, uint32 resizeMask, uint32 flags) : @@ -880,9 +880,9 @@ // calc the last day one month before if (date.Month() == 1) - date.SetDate(date.Year() -1, 12, fDay); + date.SetDate(date.Year() -1, 12, 1); else - date.SetDate(date.Year(), date.Month() - 1, fDay); + date.SetDate(date.Year(), date.Month() - 1, 1); const int32 lastDayBefore = date.DaysInMonth(); int32 counter = 0;