Bug 165011 - Spreadsheet formula =WEEKNUM(TODAY(),) is not imported correctly from xlsx
Summary: Spreadsheet formula =WEEKNUM(TODAY(),) is not imported correctly from xlsx
Status: VERIFIED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Calc (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Andras Timar
URL:
Whiteboard: target:25.8.0 target:24.8.6 target:25...
Keywords:
Depends on:
Blocks: Missed-Excel-Functions
  Show dependency treegraph
 
Reported: 2025-02-03 13:30 UTC by Andras Timar
Modified: 2025-02-11 21:29 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
minimal reproducer (xlsx) (8.63 KB, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet)
2025-02-03 13:30 UTC, Andras Timar
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andras Timar 2025-02-03 13:30:12 UTC
Description:
Spreadsheet formula =WEEKNUM(TODAY(),) is not imported correctly from xlsx. It is arguable whether empty 2nd parameter is valid, but we found formulas like this in the wild, and Excel does not have problems with it.

Steps to Reproduce:
1. Open the attached bug document
2. Observe Err:502 in cell B1 


Actual Results:
Err:502

Expected Results:
The week number of today.


Reproducible: Always


User Profile Reset: No

Additional Info:
.
Comment 1 Andras Timar 2025-02-03 13:30:55 UTC
Created attachment 198939 [details]
minimal reproducer (xlsx)
Comment 2 Andras Timar 2025-02-03 14:01:19 UTC
https://gerrit.libreoffice.org/c/core/+/181048
Comment 3 Commit Notification 2025-02-04 06:55:04 UTC
Andras Timar committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/bfb8dbc4a6a462bc9a836d125faaeafd81daadd9

tdf#165011 accept empty second parameter of WEEKNUM spreadsheet function

It will be available in 25.8.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 4 Timur 2025-02-04 10:35:00 UTC
Excel syntax is: WEEKNUM(serial_number,[return_type]) where return_type is optional with default value of 1 (week begins on Sunday, always from 01.01.).
So this looks good to me. I checked with random weeknum calculations.
Thanks.
Comment 5 Commit Notification 2025-02-04 11:47:33 UTC
Andras Timar committed a patch related to this issue.
It has been pushed to "libreoffice-24-8":

https://git.libreoffice.org/core/commit/199f1c9da36470ce46b653f95a447e9d78d9605c

tdf#165011 accept empty second parameter of WEEKNUM spreadsheet function

It will be available in 24.8.6.

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

Affected users are encouraged to test the fix and report feedback.
Comment 6 Commit Notification 2025-02-04 12:24:43 UTC
Andras Timar committed a patch related to this issue.
It has been pushed to "libreoffice-25-2":

https://git.libreoffice.org/core/commit/f533a8278e56a5c0c6d909f8227497774bcab1ed

tdf#165011 accept empty second parameter of WEEKNUM spreadsheet function

It will be available in 25.2.1.

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

Affected users are encouraged to test the fix and report feedback.
Comment 7 Commit Notification 2025-02-11 21:29:15 UTC
Andras Timar committed a patch related to this issue.
It has been pushed to "libreoffice-24-8-5":

https://git.libreoffice.org/core/commit/ffa1dd40bd10d265c7bf8e25ba2e7ca24a061785

tdf#165011 accept empty second parameter of WEEKNUM spreadsheet function

It will be available in 24.8.5.

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

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