diff options
author | Eike Rathke <erack@redhat.com> | 2016-01-05 15:42:27 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-01-18 21:45:06 +0000 |
commit | 3665652285f29021f4a12cc493fe8791b6afc126 (patch) | |
tree | 0a5c7c95bc05ad8ddee9eb322c4f621719119524 | |
parent | 86a15daa99f57ddf5ddbdb2d67ed9d69e3bbbf37 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
-rw-r--r-- | sc/source/core/tool/interpr2.cxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 84a5bff3d6bc..d82bc29eaff9 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()); |