Bug 447576

Summary: Event - Repeat - Ends - On: Date picker adds 1 month to selected month
Product: [Applications] Merkuro Reporter: aleksi.karpansalo
Component: generalAssignee: Claudio Cambra <claudio.cambra>
Status: RESOLVED FIXED    
Severity: minor CC: carl
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description aleksi.karpansalo 2021-12-27 14:00:20 UTC
SUMMARY
When adding or editing a task or event, the Repeat setting's Ends On date picker does not work as expected.
When the user picks a date, the resulting date is 1 month in the future from the user picked date.

STEPS TO REPRODUCE
1. Start adding a new event
2. Set Repeat to anything but Never
3. Set the now visible Ends to On
4. Pick any date for now visible On

OBSERVED RESULT
The date will be a month later than was picked

EXPECTED RESULT
The date is what was picked

SOFTWARE/OS VERSIONS
Kalendar commit 2c4a29ea

ADDITIONAL INFORMATION
Seems to be caused by DateCombo using 1...12 for months while Date uses 0...11

src/contents/ui/IncidenceEditor.qml line ~637
onNewDateChosen: root.incidenceWrapper.setRecurrenceDataItem("endDateTime", new Date(year, month, day));
could be changed to
onNewDateChosen: root.incidenceWrapper.setRecurrenceDataItem("endDateTime", new Date(year, month-1, day));

This is the only place using "new Date(year, month, day)" to pass a DateCombo picked date as far as I can tell
Comment 1 Claudio Cambra 2021-12-28 20:51:49 UTC
Thanks for reporting this bug and for your investigation, you were right -- mismatch between the QDateTime-style month numbers and JS Date month numbers used by QML.

Fixed with latest commit!