Description: Weeknum is defined in the openformula standard as: > Returns the number of the week in the year for the given date Currently, libreoffice returns 1 for dates like 2025-12-31, which is wrong. From my testing it looks like libreoffice says that a week is a consecutive 7 days and week 1 is the week of the year which contains the first sunday (for default) or X day of week for the "mode" version. Maybe I am reading the standard wrong, but it seems to me that the (admittedly vague) standard would require returning 53, since the last day of the year is in the 53rd week of that year even if that week is a partial week. This matches with what excel and sheets do. If I am reading the standard wrong, then at least the documentation should stop saying "compatible with other spreadsheet programs" when it does not, and I would advocate for a compatibility function like "WEEKNUM_EXCEL" to make importing work correctly. Steps to Reproduce: Type =WEEKNUM(DATE(2025,12,31)) Actual Results: 1 Expected Results: 53 Reproducible: Always User Profile Reset: No Additional Info: Version: 25.8.1.1 (X86_64) Build ID: 54047653041915e595ad4e45cccea684809c77b5 CPU threads: 16; OS: Windows 11 X86_64 (build 26100); UI render: Skia/Raster; VCL: win Locale: en-US (en_US); UI: en-US Calc: threaded
https://docs.oasis-open.org/office/OpenDocument/v1.4/OpenDocument-v1.4-part4-formula.html#WEEKNUM > Syntax: WEEKNUM( DateParam D [ ; Number Mode = 1 ] ) It tells that mode 1 is the default, used when you don't explicitly specify the mode, as in your "=WEEKNUM(DATE(2025,12,31))". > For Mode = {1, 2, 11, 12, ..., 17} the week containing January 1 is the first > week of the year It means, that the week of 2025-12-31, which is the same week as for 2026-01-01, is week 1. (In reply to documentfoundation.crummy860 from comment #0) > If I am reading the standard wrong, then at least the documentation should > stop saying "compatible with other spreadsheet programs" when it does not "Compatible with other spreadsheet programs" does not contradict with "implements standard correctly". If there is a problem with the standard, you are welcome to file a request to OASIS (which Microsoft is member of). Not a bug.