Bug 100070 - UKENR (Norwegian WEEKNUM function) gives wrong week numbers.
Summary: UKENR (Norwegian WEEKNUM function) gives wrong week numbers.
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Calc-Function
  Show dependency treegraph
 
Reported: 2016-05-26 18:38 UTC by Ole Holte Sandvik
Modified: 2020-02-02 14:19 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ole Holte Sandvik 2016-05-26 18:38:28 UTC
User-Agent:       Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0
Build Identifier: LibreOffice 5.1.2.2

LibreOffice versjon 5.1.2.2. Norwegian version. Function UKENR(01.01.1995;1) is expected to be different than UKENR(01.01.1995;2), but provides the same output. I have not tried the English version but it is the WEEKNUM function.

Reproducible: Always

Steps to Reproduce:
1. Install Norwegian version of LO 5.1.2.2
2. Enter =UKENR(01.01.1995;2). 
3. Compare with =UKENR(01.01.1995;1) 
Actual Results:  
Both provide week 1 as output

Expected Results:  
 =UKENR(01.01.1995;2) should output week no 52
 =UKENR(01.01.1995;1) sould output week 1 

[Information automatically included from LibreOffice]
Locale: nb
Module: SpreadsheetDocument
[Information guessed from browser]
OS: Linux (All)
OS is 64bit: yes


Reset User Profile?No
Comment 1 A (Andy) 2016-05-26 19:42:55 UTC
I suppose you have used =UKENR("01.01.1995";2) instead of =UKENR(01.01.1995;2)?

For me this is reproducible with LO 5.1.3.2, (Win 8.1).  I also receive only 1.  This is differently than expected (see https://help.libreoffice.org/Calc/WEEKNUM).
Comment 2 Ole Holte Sandvik 2016-05-27 08:56:35 UTC
Sorry for the delay. Yes, I used =UKENR("01.01.1995";2) instead of =UKENR(01.01.1995;2).
Comment 3 Alex H. 2017-12-09 19:35:26 UTC
I didn't try in Norwegian, only in English, but I can confirm the behavior. However, I think that the behavior is correct and that there is a mistake in the documentation.

At https://help.libreoffice.org/Calc/WEEKNUM it says:

  System 1: The week containing January 1 is the first week of the
  year, and is numbered week 1.

In other words, if the mode argument is either absent, 1, 2, 11, 12, 13, 14, 15, 16 or 17, for January 1st of _any_ year the return value must be 1.

However, this directly contradicts the example further down on the same page:

  =WEEKNUM(DATE(1995;1;1);2) returns 52. If the week starts on Monday,
  Sunday belongs to the last week of the previous year.

This is wrong, I think. January 1st 1995 was a Sunday, but that doesn't even matter under system 1, where the outcome should be 1 regardless of which day the week starts on.

(The Norwegian version of that page, https://help.libreoffice.org/Calc/WEEKNUM/nb, contains essentially the same text.)
Comment 4 QA Administrators 2018-12-10 03:40:20 UTC Comment hidden (obsolete)
Comment 5 Ole Holte Sandvik 2018-12-10 20:17:42 UTC
I can confirm that the mistake is in the documentation, and that it has not been corrected.

Alex got it right. It is just the example in the documentation that is incorrect. The documentation explains correctly, except for the example.

However, if possible, a reference to the ISOWEEKNUM function should be included. This gives the output that European users, and users from many other countries, want without setting mode argument.
Comment 6 Julien Nabet 2020-02-02 14:19:24 UTC
Olivier: it seems there's indeed a pb in the doc.
The end of the page https://help.libreoffice.org/7.0/en-US/text/scalc/01/func_weeknum.html?DbPAR=CALC#bm_id3159161 indicates this:
=WEEKNUM(DATE(1995;1;1);1) returns 1
(OK)

=WEEKNUM(DATE(1995;1;1);2) returns 52. If the week starts on Monday, Sunday belongs to the last week of the previous year.
(Wrong)
it returns 1