Kaydet (Commit) 14e31d6c authored tarafından Eike Rathke's avatar Eike Rathke

Resolves: tdf#100440 check mode to be 0 or 1 for MONTHS(), YEARS() and WEEKS()

Needed to adapt the WEEKS and YEARS test documents to cope with the
change.

Change-Id: Ia52505418f4fed684bd04290c608e2a65eee2fbc
üst ad59dcf7
......@@ -591,6 +591,9 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffWeeks(
sal_Int32 nStartDate, sal_Int32 nEndDate,
sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException, std::exception )
{
if (nMode != 0 && nMode != 1)
throw lang::IllegalArgumentException();
sal_Int32 nNullDate = GetNullDate( xOptions );
sal_Int32 nDays1 = nStartDate + nNullDate;
......@@ -628,6 +631,9 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffMonths(
sal_Int32 nStartDate, sal_Int32 nEndDate,
sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException, std::exception )
{
if (nMode != 0 && nMode != 1)
throw lang::IllegalArgumentException();
sal_Int32 nNullDate = GetNullDate( xOptions );
sal_Int32 nDays1 = nStartDate + nNullDate;
......@@ -673,6 +679,9 @@ sal_Int32 SAL_CALL ScaDateAddIn::getDiffYears(
sal_Int32 nStartDate, sal_Int32 nEndDate,
sal_Int32 nMode ) throw( uno::RuntimeException, lang::IllegalArgumentException, std::exception )
{
if (nMode != 0 && nMode != 1)
throw lang::IllegalArgumentException();
if ( nMode != 1 )
return getDiffMonths( xOptions, nStartDate, nEndDate, nMode ) / 12;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment