Bug #3574
closedWt::WCalendar browseToNextMonth() does not work correctly
0%
Description
clicking a date in the next month from December and attaching an event to the calendar that calls browseToNextMonth() takes the calendar to November in the same year.
Additionally when using a calendar which is connected to a WDateEdit as shown below, the calendar will only browse to the next once but it will browse to the previous month as expected.
@
Wt::WDateEdit* de = new Wt::WDateEdit(root());
Wt::WCalendar* cal = de->calendar();
cal->setSelectionMode(Wt::SelectionMode::ExtendedSelection);
cal->clicked().connect(std::bind([=](Wt::WDate d) {
std::cout << cal->currentMonth();
std::cout << d.month();
if(d.month() > cal->currentMonth())
{
std::cout << "GO NEXT\n";
cal->browseToNextMonth();
return;
}
else if(d.month() < cal->currentMonth())
{
std::cout << "GO PREV\n";
cal->browseToPreviousMonth();
return;
}
}, std::placeholders::_1));@
Updated by Koen Deforche about 10 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
- Target version changed from 3.3.3 to 3.3.4
Updated by Koen Deforche about 10 years ago
- Status changed from InProgress to Feedback
Hey,
I believe it's because you only check the month, not the year, and month '1' < month '12' ?
Regards,
koen
Updated by Alex V about 10 years ago
Hi Koen,
That solves the first issue which was created when I quickly wrote the example case and is a problem with the test code, Which I thought at the time was related to the actual bug which I described poorly in the description.
The actual bug is that the calendar widget only browses forwards once. For example with the code above clicking a November date from October works but then clicking a date in December from November does not do anything. The event handler is called, "GO NEXT" is printed but the calendar remains on November.
the behaviour is the same using
cal->browseToNextMonth();
and
cal->browseTo(d);
Firefox 30.0, Wt 3.3.3
Updated by Koen Deforche about 10 years ago
- Status changed from Feedback to Resolved
Hey,
I couldn't reproduce this with latest git, but I believe it's been fixed indeed because of other changes. Could you check with latest git?
Koen
Updated by Koen Deforche about 10 years ago
- Status changed from Resolved to Closed