Bug 96198 - Editing: Function WEEKNUM() gives different values if opend in LO 5.1.0.1 or older versions
Summary: Editing: Function WEEKNUM() gives different values if opend in LO 5.1.0.1 or ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
5.1.0.1 rc
Hardware: All All
: medium normal
Assignee: Eike Rathke
URL:
Whiteboard: target:5.2.0 target:5.1.0.2 target:5...
Keywords: regression
Depends on:
Blocks:
 
Reported: 2015-12-02 07:37 UTC by helmut
Modified: 2016-10-25 19:12 UTC (History)
6 users (show)

See Also:
Crash report or crash signature:


Attachments
Please, edit date in cell "S130"! (28.72 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-12-16 12:45 UTC, helmut
Details
Edit date in S130 from 2016 to 2017 or 2015 then back to 2016 (28.72 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-12-16 21:42 UTC, helmut
Details
Open Calc-document with LO 5.0.4.2 (or older), then with 5.1.0.1 - different values for weeknum. (8.31 KB, application/vnd.oasis.opendocument.spreadsheet)
2015-12-21 19:47 UTC, Robert Großkopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description helmut 2015-12-02 07:37:34 UTC
Excuse me. I don't know the English-Name for KALENDERWOCHE().

Now to my description:
I open a Spreadsheet, editing with LO 5.0.4.1, with LO 5.1.x.x or LO 5.2.x.x.
I save it. Then I reopen it with LO 5.0.4.1.
The function is changed in KALENDERWOCHE_ADD() and the result is incorrect.

I hope, I can help with this description.

Best regards, Helmut Wolff!
Comment 1 raal 2015-12-02 12:39:00 UTC Comment hidden (obsolete)
Comment 3 helmut 2015-12-16 12:44:30 UTC
I've edit a calc-documet with LO-Version 5.0.x.x.
When I save or edit it with LO-Version 5.1.x.x  or 5.2.x.x, the result of weeknum() get incorrect.

Please, edit date in cell "S130"!

Merry Christmas and all good wishes for 2016, Helmut wolff1
Comment 4 helmut 2015-12-16 12:45:55 UTC
Created attachment 121338 [details]
Please, edit date in cell "S130"!
Comment 5 raal 2015-12-16 16:24:20 UTC
(In reply to wolff-ohlenberg from comment #4)
> Created attachment 121338 [details]
> Please, edit date in cell "S130"!

Cannot reproduce with Version: 5.1.0.0.alpha1+. Changed S130 to 01.01.2017, saved, close, reopen -  function weeknum for example in T128 is unchanged.
Comment 6 helmut 2015-12-16 21:42:15 UTC
Created attachment 121356 [details]
Edit date in S130 from 2016 to 2017 or 2015 then back to 2016

Hallo,

another discription: edit the date in S130, for example in 2017,
then edit back the date in 2016.

Declaration: Sunday is the last day of the week and the weeknumber stand for till the monday before.

I hope, I can help with this information!

Dear Helmut Wolff!
Comment 7 helmut 2015-12-20 16:32:17 UTC
Hello,

a recive comment say, that weeknum() do correctly, but wochentag() not.
Perhaps there is a mistake in the german location.
As a german people, I still work with wochentag().

I hope, I can do something against the problem.

Merry christmas and a happy new year, Helmut!
Comment 8 Robert Großkopf 2015-12-21 19:47:46 UTC
Created attachment 121478 [details]
Open Calc-document with LO 5.0.4.2 (or older), then with 5.1.0.1 - different values for weeknum.

Open the attached Calc-document with LO 5.1.0.1 and then with LO 5.0.4.2 or other older versions.
Weeknum gives different values for the same Calc-document, if opened in LO 5.1.0.1 or all other versions up to LO 5.0.4.2.
Function 
WEEKNUM("12/21/15",1)
gives '52' in LO 5.1.0.1, but '51' in all versions up to LO 5.0.4.2
WEEKNUM("12/21/15",2)
gives '51' in LO 5.1.0.1, but '52' in all versions up to LO 5.0.4.2
Modus '1' should begin the week with Sunday, but it begins with Monday in LO 5.1.0.1
Modus '2' should begin the week with Monday, but it begins with Thursday in LO 5.1.0.1

There is another bug when switching from LO 5.1.0.1 to LO 5.0.4.2: German "KALENDERWOCHE" (WEEKNUM) will be changed in LO 5.0.4.2 to "KALENDERWOCHE_ADD" - will report this in another bugdescription.

Tested all with OpenSUSE 42.1 Leap 64bit rpm Linux.
Comment 9 Robert Großkopf 2015-12-21 19:51:06 UTC
C
Comment 10 Buovjaga 2015-12-29 18:41:21 UTC
NEW per comment 8.
Comment 11 GerardF 2015-12-29 21:17:49 UTC
See bug 50950.
If I correctly understand what Wielfried do,
In 5.1 and laters we will have :
ISOWEEKNUM for weeknum ISO 8601 (was WEEKNUM with 2nd parameter !=1 in 5.0 and olders)
WEEKNUM_EXCEL2003 (was WEEKNUM_ADD in previous versions)
and a new WEEKNUM (this one comply to ODF 1.2 and is the same as EXCEL2007 and further).

The big problem is that opening a shhet created with 5.0.x or previous and with WEEKNUM function break ascendant compatibility as ISO week in 5.0 become "US" week in 5.1.

For backward compatibility, as said in comment 8, WEEKNUM is change to WEEKNUM_ADD. Here, I think this is not "completly a bug".
Comment 12 GerardF 2015-12-30 09:54:45 UTC
(In reply to GerardF from comment #11)

> If I correctly understand what Wielfried do,

Sorry Winfried, I mistype your name.
Comment 13 Eike Rathke 2016-01-04 13:39:43 UTC
Taking.
Comment 14 Eike Rathke 2016-01-04 17:27:34 UTC
http://cgit.freedesktop.org/libreoffice/core/commit/?id=7ea839ae3904d96dcea35a0339f3e6ee7d58bbaa
and
http://cgit.freedesktop.org/libreoffice/core/commit/?id=dee3bcdb9e91f338b66872ae939bf790ab7bf061&h=libreoffice-5-1
partly fix the DayOfWeek calculation.

However, the old WEEKNUM with mode<>1 implemented the ISOWEEKNUM, with mode==1 it implemented something that doesn't make sense.. i.e. like ISO but with week starting on Sunday instead of Monday. Need to figure out how to solve that.

WEEKNUM saved in 5.1 loaded in 5.0 displaying as WEEKNUM_ADD is *not* a bug. WEEKNUM was wrongly saved as ODFF ISOWEEKNUM in 5.0 and earlier, which is part of all this confusion.
Comment 15 GerardF 2016-01-04 20:15:19 UTC
(In reply to Eike Rathke from comment #14)
 
> WEEKNUM saved in 5.1 loaded in 5.0 displaying as WEEKNUM_ADD is *not* a bug.

So the only way to have compatibility between 5.1 (or more) and 5.0.x (or less) is to use WEEKNUM with mode=1 and save as .xlsx format...
:(
Comment 16 GerardF 2016-01-04 20:16:44 UTC
(In reply to GerardF from comment #15)
> (In reply to Eike Rathke from comment #14)
>  
> > WEEKNUM saved in 5.1 loaded in 5.0 displaying as WEEKNUM_ADD is *not* a bug.
> 
> So the only way to have compatibility between 5.1 (or more) and 5.0.x (or
> less) is to use WEEKNUM with mode=1 and save as .xlsx format...
> :(

Sorry, read WEEKNUM with mode=21
Comment 17 helmut 2016-01-04 21:39:53 UTC
Hello to all,

thanks for help!

All good wishes for 2016 sends Helmut!
Comment 18 Eike Rathke 2016-01-05 10:45:18 UTC
GRRR... why do you set this to resolved fix? I'm still working on it.
Comment 19 Commit Notification 2016-01-05 11:12:11 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2f79244cb3fcc4cbfd2b818380ea9d62b49aaade

tdf#96198 detect old ISO/WEEKNUM usage with two arguments, tdf#50950 follow-up

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 20 Commit Notification 2016-01-05 13:27:40 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=1efc41a87e2b9491b2a7471b1154a4d586a21c37

tdf#96198 adapt unit test to reality, tdf#50950 follow-up

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 21 Commit Notification 2016-01-05 13:51:37 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3e5deb8ccfaf0b73fb6cf394822e560dc036a686&h=libreoffice-5-1

tdf#96198 detect old ISO/WEEKNUM usage with two arguments, tdf#50950 follow-up

It will be available in 5.1.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 22 Commit Notification 2016-01-05 13:51:45 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=63931f25785e25368ee808f4e0e269f91c99d0e6&h=libreoffice-5-1

tdf#96198 adapt unit test to reality, tdf#50950 follow-up

It will be available in 5.1.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 23 Eike Rathke 2016-01-05 14:58:01 UTC
Pending review https://gerrit.libreoffice.org/21118 for 5-0 forward compatibility.
Comment 24 Commit Notification 2016-01-05 18:31:18 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=902c593196741ffec2d096855369313f6bbe756e

tdf#96198 add WEEKNUM_OOO compatibility function, tdf#50950 follow-up

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 25 Commit Notification 2016-01-05 19:58:08 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=efeef720de31fe0fab9013f954eac63fe49fa59d&h=libreoffice-5-1

tdf#96198 add WEEKNUM_OOO compatibility function, tdf#50950 follow-up

It will be available in 5.1.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 26 Commit Notification 2016-01-07 18:39:12 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=7994b77819a5de7a6da46ab01386883559e7a7d1

tdf#96198 postpone conversion from WEEKNUM to ISOWEEKNUM, tdf#50950 follow-up

It will be available in 5.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 28 Commit Notification 2016-01-08 12:35:22 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-5-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=2d877037bbf97aafed9d355a93dd3e915d80e74b&h=libreoffice-5-1

tdf#96198 postpone conversion from WEEKNUM to ISOWEEKNUM, tdf#50950 follow-up

It will be available in 5.1.0.2.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 29 Commit Notification 2016-01-18 21:46:26 UTC
Eike Rathke committed a patch related to this issue.
It has been pushed to "libreoffice-5-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=3665652285f29021f4a12cc493fe8791b6afc126&h=libreoffice-5-0

tdf#96198 accept WEEKNUM with only one parameter, tdf#50950 follow-up

It will be available in 5.0.5.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.