sc/qa/unit/data/functions/date_time/fods/weeknum.fods | 10 +++++----- sc/source/core/tool/interpr2.cxx | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 6 deletions(-)
New commits: commit ffa1dd40bd10d265c7bf8e25ba2e7ca24a061785 Author: Andras Timar <andras.ti...@collabora.com> AuthorDate: Mon Feb 3 14:55:54 2025 +0100 Commit: Michael Weghorn <m.wegh...@posteo.de> CommitDate: Tue Feb 11 22:28:16 2025 +0100 tdf#165011 accept empty second parameter of WEEKNUM spreadsheet function and treat it like if it was the the default "1". Change-Id: I618575a7441a2a6650228fc1a29177e294933ce0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181048 Tested-by: Jenkins Reviewed-by: Andras Timar <andras.ti...@collabora.com> (cherry picked from commit bfb8dbc4a6a462bc9a836d125faaeafd81daadd9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181097 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> (cherry picked from commit 199f1c9da36470ce46b653f95a447e9d78d9605c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/181104 Tested-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> Reviewed-by: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> Reviewed-by: Ilmari Lauhakangas <ilmari.lauhakan...@libreoffice.org> diff --git a/sc/qa/unit/data/functions/date_time/fods/weeknum.fods b/sc/qa/unit/data/functions/date_time/fods/weeknum.fods index a4e1c08ebbd6..2f84286ae929 100644 --- a/sc/qa/unit/data/functions/date_time/fods/weeknum.fods +++ b/sc/qa/unit/data/functions/date_time/fods/weeknum.fods @@ -769,13 +769,13 @@ <table:table-cell table:number-columns-repeated="3"/> </table:table-row> <table:table-row table:style-name="ro5"> - <table:table-cell table:style-name="ce20" table:formula="of:=WEEKNUM([.K9];)" office:value-type="string" office:string-value="" calcext:value-type="error"> - <text:p>Err:502</text:p> + <table:table-cell table:style-name="ce20" table:formula="of:=WEEKNUM([.K9];)" office:value-type="float" office:value="31" calcext:value-type="float"> + <text:p>31</text:p> </table:table-cell> - <table:table-cell office:value-type="string" calcext:value-type="string"> - <text:p>ERR</text:p> + <table:table-cell office:value-type="float" office:value="31" calcext:value-type="float"> + <text:p>31</text:p> </table:table-cell> - <table:table-cell table:style-name="ce23" table:formula="of:=ISERROR([.A9])" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> + <table:table-cell table:style-name="ce23" table:formula="of:=[.A9]=[.B9]" office:value-type="boolean" office:boolean-value="true" calcext:value-type="boolean"> <text:p>PRAVDA</text:p> </table:table-cell> <table:table-cell table:style-name="ce24" table:formula="of:=FORMULA([.A9])" office:value-type="string" office:string-value="=WEEKNUM(K9;)" calcext:value-type="string"> diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 2d87abed4789..c556df37d1cb 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -253,7 +253,20 @@ void ScInterpreter::ScGetWeekOfYear() if ( !MustHaveParamCount( nParamCount, 1, 2 ) ) return; - sal_Int16 nFlag = ( nParamCount == 1 ) ? 1 : GetInt16(); + sal_Int16 nFlag; + if (nParamCount == 1) + { + nFlag = 1; + } + else if (GetRawStackType() == svMissing) + { + nFlag = 1; + Pop(); + } + else + { + nFlag = GetInt16(); + } Date aDate = mrContext.NFGetNullDate(); aDate.AddDays( GetFloor32());