diff options
author | Winfried Donkers <winfrieddonkers@libreoffice.org> | 2016-09-09 13:18:42 +0200 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-09-16 21:14:38 +0000 |
commit | 3bf31803959ccc54bb949630f936a768ef47a90b (patch) | |
tree | c9d4763511f6c20993a3f8e8e2c71b29f933aa52 | |
parent | 0aa73cd0ff10c9b680c38e59147db684ff1ab14c (diff) |
tdf#101541 function WORKDAY.INTL not working properly
When holidays are adjacent to weekend days, wrong results occurred.
Change-Id: I9ec86e00f1a62ea941ff70617a1b448601aff9cc
Reviewed-on: https://gerrit.libreoffice.org/28771
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
(cherry picked from commit 5e9d5eeb8a33fdcc500377d9eace40b5f5a7f750)
Reviewed-on: https://gerrit.libreoffice.org/28970
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-on: https://gerrit.libreoffice.org/28973
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index bd255fc83290..d2877189fe16 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -513,14 +513,16 @@ void ScInterpreter::ScWorkday_MS() size_t nRef = 0; while ( nDays ) { - while ( nRef < nMax && nSortArray.at( nRef ) < nDate ) - nRef++; - if ( !( nRef < nMax && nSortArray.at( nRef ) == nDate ) || nRef >= nMax ) - nDays--; - do + { ++nDate; + } while ( bWeekendMask[ GetDayOfWeek( nDate ) ] ); //jump over weekend day(s) + + while ( nRef < nMax && nSortArray.at( nRef ) < nDate ) + nRef++; + if ( !( nRef < nMax && nSortArray.at( nRef ) == nDate ) || nRef >= nMax ) + nDays--; } } else @@ -528,14 +530,16 @@ void ScInterpreter::ScWorkday_MS() sal_Int16 nRef = nMax - 1; while ( nDays ) { + do + { + --nDate; + } + while ( bWeekendMask[ GetDayOfWeek( nDate ) ] ); //jump over weekend day(s) + while ( nRef >= 0 && nSortArray.at( nRef ) > nDate ) nRef--; if ( !( nRef >= 0 && nSortArray.at( nRef ) == nDate ) || nRef < 0 ) nDays++; - - do - --nDate; - while ( bWeekendMask[ GetDayOfWeek( nDate ) ] ); //jump over weekend day(s) } } PushDouble( ( double ) ( nDate - nNullDate ) ); |