sc/source/core/tool/interpr2.cxx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
New commits: commit 3665652285f29021f4a12cc493fe8791b6afc126 Author: Eike Rathke <er...@redhat.com> Date: Tue Jan 5 15:42:27 2016 +0100 tdf#96198 accept WEEKNUM with only one parameter, tdf#50950 follow-up Loading ISOWEEKNUM(date) maps to WEEKNUM(date) so accept the actual ISOWEEKNUM parameter count defined in ODFF. This also ensures forward compatibility with 5.1 where 3e5deb8ccfaf0b73fb6cf394822e560dc036a686 (cherry picked from commit 15494f0f99d1cf6f75e8c2996377b242af247bbf) converts ISOWEEKNUM(date,mode) to real ISOWEEKNUM(date) if mode!=1 as there is no matching WEEKNUM(date,mode) defined. This WEEKNUM here never implemented the ODFF WEEKNUM but a mix of ISOWEEKNUM and something undefined different. Change-Id: Ibd0d4483486a1db28cc600821baae9f13b9dd687 Reviewed-on: https://gerrit.libreoffice.org/21118 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Markus Mohrhard <markus.mohrh...@googlemail.com> diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 84a5bff..d82bc29 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -207,9 +207,12 @@ void ScInterpreter::ScGetDayOfWeek() void ScInterpreter::ScGetWeekOfYear() { - if ( MustHaveParamCount( GetByte(), 2 ) ) + sal_uInt8 nParamCount = GetByte(); + if ( MustHaveParamCount( nParamCount, 1, 2 ) ) { - short nFlag = (short) ::rtl::math::approxFloor(GetDouble()); + // Without mode parameter calculate ISO 8601 week starting on Monday + // like ISOWEEKNUM(), which this is loaded from. + short nFlag = (nParamCount == 1) ? 0 : (short) ::rtl::math::approxFloor(GetDouble()); Date aDate = *(pFormatter->GetNullDate()); aDate += (long)::rtl::math::approxFloor(GetDouble()); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits