Date difference: display the difference in days (only) when we aren't able to calculate the difference in days/weeks/months.. (#555)

* Display date difference in days if can't display in days/weeks/months/...

* add comments

* remove not used variable totalDaysDiff

* improve UpdateDisplayResult

* Display error message when the calculator can't calculate the difference between 2 dates
This commit is contained in:
Rudy Huyn
2019-06-30 18:22:29 -07:00
committed by Eric Wong
parent 25708f0bef
commit 2a5a52d44d
5 changed files with 68 additions and 21 deletions

View File

@@ -300,7 +300,7 @@ TEST_METHOD(TestDateDiff)
// }
// // Calculate the difference
// m_DateCalcEngine.GetDateDifference(DateUtils::SystemTimeToDateTime(datetimeDifftest[testIndex].startDate),
// m_DateCalcEngine.TryGetDateDifference(DateUtils::SystemTimeToDateTime(datetimeDifftest[testIndex].startDate),
// DateUtils::SystemTimeToDateTime(datetimeDifftest[testIndex].endDate), dateOutputFormat, &diff);
// // Assert for the result
@@ -1050,8 +1050,7 @@ TEST_METHOD(JaEraTransitionDifference)
auto endTime = cal->GetDateTime();
DateDifference diff;
viewModel->GetDateDifference(startTime, endTime, DateUnit::Day, &diff);
VERIFY_IS_TRUE(viewModel->TryGetDateDifference(startTime, endTime, DateUnit::Day, &diff));
VERIFY_ARE_EQUAL(diff.day, 19);
}
}