calculator/src/CalcViewModel
Peter Tissen dab589b3e0 Handle date difference for ends of months (#553)
The incrementally calling `Window::Globalization::Calendar::AddMonths`
resulted in a negative value for `GetDifferenceInDays` which was then
assigned to an unsigned variable `daysDiff`.

One example of the issue when running the calculator in UTC+2 was the
difference between July 31st and December 30th.

The initial guess was 4 months which then landed on November 30th.
This date was stored and then in the loop incremeted by one month.
This then landed precisely on the end date December 30th.
After the loop the final value is then used July 31st + 5 months
which results in the 31st of December.
The resulting difference of -1 days is then assigned to the unsigned
value `daysDiff`.

This commit makes the minimal changes to remedy this bug.
It makes sure to only ever call `AddMonths` with the same starting date
instead of incrementally to different dates.

fixes #552
2019-06-17 16:05:31 -07:00
..
Common Handle date difference for ends of months (#553) 2019-06-17 16:05:31 -07:00
DataLoaders Add CMake project, GCC support (#540) 2019-06-06 14:08:31 -07:00
ApplicationViewModel.cpp Fix the project code style, as it is not consistent. (#236) 2019-05-02 11:59:19 -07:00
ApplicationViewModel.h Fix the project code style, as it is not consistent. (#236) 2019-05-02 11:59:19 -07:00
CalcViewModel.vcxproj Migrate currency converter endpoints (#524) 2019-05-31 12:55:06 -07:00
CalcViewModel.vcxproj.filters Migrate currency converter endpoints (#524) 2019-05-31 12:55:06 -07:00
DateCalculatorViewModel.cpp Fix unit tests to run on non-english devices (#289) 2019-05-14 09:57:58 -07:00
DateCalculatorViewModel.h Fix the project code style, as it is not consistent. (#236) 2019-05-02 11:59:19 -07:00
HistoryItemViewModel.cpp Secondary formatting changes (#489) 2019-05-02 16:48:33 -07:00
HistoryItemViewModel.h Secondary formatting changes (#489) 2019-05-02 16:48:33 -07:00
HistoryViewModel.cpp Secondary formatting changes (#489) 2019-05-02 16:48:33 -07:00
HistoryViewModel.h Secondary formatting changes (#489) 2019-05-02 16:48:33 -07:00
MemoryItemViewModel.cpp Hello GitHub 2019-01-28 16:24:37 -08:00
MemoryItemViewModel.h Secondary formatting changes (#489) 2019-05-02 16:48:33 -07:00
packages.config Hello GitHub 2019-01-28 16:24:37 -08:00
pch.cpp Fix the project code style, as it is not consistent. (#236) 2019-05-02 11:59:19 -07:00
pch.h Fix the project code style, as it is not consistent. (#236) 2019-05-02 11:59:19 -07:00
StandardCalculatorViewModel.cpp Keep spaces when users copy an error message (#430) 2019-05-10 22:55:15 -04:00
StandardCalculatorViewModel.h Remove Serialize/Deserialize functions never used in StandardCalculatorViewModel, UnitConverter, UnitConverterViewModel and CalculatorManager (#392) 2019-05-09 11:01:43 -07:00
targetver.h Fix the project code style, as it is not consistent. (#236) 2019-05-02 11:59:19 -07:00
UnitConverterViewModel.cpp Add CMake project, GCC support (#540) 2019-06-06 14:08:31 -07:00
UnitConverterViewModel.h Remove Serialize/Deserialize functions never used in StandardCalculatorViewModel, UnitConverter, UnitConverterViewModel and CalculatorManager (#392) 2019-05-09 11:01:43 -07:00
ViewState.cpp Fix the project code style, as it is not consistent. (#236) 2019-05-02 11:59:19 -07:00
ViewState.h Fix the project code style, as it is not consistent. (#236) 2019-05-02 11:59:19 -07:00