Bug 158845 - function NUM.SETTIMANA (or NUM.WEEK in english) gives wrong results for a leap year
Summary: function NUM.SETTIMANA (or NUM.WEEK in english) gives wrong results for a le...
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
7.6.2.1 release
Hardware: All All
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-23 19:15 UTC by Vito Caleandro
Modified: 2023-12-23 19:57 UTC (History)
1 user (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 Vito Caleandro 2023-12-23 19:15:25 UTC
Description:
function NUM.SETTIMANA  (or NUM.WEEK in english) in Libreoffice Calc gives 1 for the date of 30/12/2024 rather than 53 !
Then next year is a leap year!

Steps to Reproduce:
1.set A1 value to 30/12/2024
2.set B1 to formula =NUM.SETTIMANA(A1)
3.

Actual Results:
1

Expected Results:
53


Reproducible: Always


User Profile Reset: No

Additional Info:
The next year has 29 february.
The same function in other spreadsheets gives the correct answer that is 53
Comment 1 Regina Henschel 2023-12-23 19:57:51 UTC
Please notice, that there exists several functions to calculate a week number:

ISOWEEKNUM

WEEKNUM

WEEKNUM_EXCEL2003

Notice, that functions WEEKNUM and WEEKNUM_EXCEL2003 have a second parameter 'Mode' to determine the start of a week and the calculation method.

If you do not need interoperability with older, foreign applications, you should use IOSWEEKNUM which follows the 'ISO 1806' standard. 

You are likely looking for WEEKNUM_EXCEL2003 with MODE=1 (Week starts on Sunday) or MODE=2 (Week starts on Monday).