* 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.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41155 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2011-03-31 21:35:53 +00:00
parent 3e59de2e62
commit c8b618048e
1 changed files with 6 additions and 6 deletions

View File

@ -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,7 +30,8 @@ FontHeight(const BView *view)
return ceilf(fheight.ascent + fheight.descent + fheight.leading);
}
} // private namespace
// #pragma mark -
BCalendarView::BCalendarView(BRect frame, const char *name,
@ -880,9 +880,9 @@ BCalendarView::_SetupDayNumbers()
// 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;