OASIS Open Document Format for Office Applications (OpenDocument) TC

 View Only

Fwd: Comment on ODF spec 1.3, weeknum function

  • 1.  Fwd: Comment on ODF spec 1.3, weeknum function

    Posted 05-18-2026 11:46
    Greetings!

    I have terribly delayed in sending Sebastian's comment to the TC.

    We have had and closed weeknum issues before. I don't know if this
    duplicates those or is a new issue.

    Patrick

    -------- Original Message --------
    Subject: Comment on ODF spec 1.3, weeknum function
    Date: 2026-01-20 04:51
    From: Sebastian Schleich <sebastian.schleich@googlemail.com>
    To: patrick@durusau.net, jos.vanden.oever@logius.nl

    Dear Mr. Durusau, Dr. Mr. van den Oever,

    I have a comment on the ODF spec 1.3. I tried to subscribe to
    office-comment-subscribe@lists.oasis-open.org as suggested here,
    https://www.oasis-open.org/committees/comments/index.php?wg_abbrev=office,
    but this did not work "The recipient server did not accept our requests
    to connect".

    I hope it's fine to address you this way.

    The definition of the WEEKNUM function appears ambiguous for Mode={1, 2,
    11, 12, ..., 17}.

    Cited from the spec [1]
    "Semantics: Returns the number of the week in the year for the given
    date.
    For Mode={1, 2, 11, 12, ..., 17} the week containing January 1 is the
    first week of the year, and is numbered week 1. The week starts on
    {Sunday, Monday, Monday, Tuesday, ..., Sunday}.""

    I am aware of two interpretations, which both have their arguments to be
    right.

    * LibreOffice puts emphasis on "The week starts on". Thereby, in most
    years, the last days of a year are assigned already to week 1 of the
    following year.
    As consequence, each set of seven days is assigned to exactly one week
    number.
    * Apple Numbers, MS Excel and Google Sheets put emphasis on "number ...
    _in the year_", i.e. they assign the last days of a year to a number >
    52 of the given year.
    As consequence, the last week (n>52) of a year may be incomplete in most
    cases, so is the first year of the next week. The output of Excel is
    conistent what Microsoft publishes in their doc [6].

    Example of how WEEKNUM(DATE;1) is evaluated. Left column: [LibreOffice],
    Right column [Apple-Numbers/MS-Excel/Google-Sheets]

    Date LibreOffice MS/Google/Apple
    Fri 2000-12-2252 52
    Sat 2000-12-23 52 52
    Sun 2000-12-24 53 53
    Mon 2000-12-25 53 53
    Tue 2000-12-26 53 53
    Wed 2000-12-27 53 53
    Thu 2000-12-28 53 53
    Fri 2000-12-29 53 53
    Sat 2000-12-30 53 53
    Sun 2000-12-31 1 54
    Mon 2001-01-01 1 1
    Tue 2001-01-02 1 1
    Wed 2001-01-03 1 1
    Thu 2001-01-04 1 1
    Fri 2001-01-05 1 1
    Sat 2001-01-06 1 1
    Sun 2001-01-07 2 2
    Mon 2001-01-08 2 2

    There are repeated discussions [2-5] about what is right and each time
    the conclusion is that the ODF spec is ambiguous.

    Side remark: from my perspective it is important to acknowlege that the
    function is called "WEEKNUM" and not "CALENDAR_WEEK" (at least in most
    languages, except -misnomer- German). What I mean to say, if I say
    "number of week", I am free to define what I want, whereas calendar week
    associtates certain properties of the numbering scheme.

    I have two questions

    1) Which of the two interpretations named above was intended by the
    authors of the specification?
    a) If January 1st does not coincide with the given start day of the
    week, January 1st still is the first day assigned to week 1, whereas
    December 31st is assigned to a week number >52 in the previous year. In
    other words, at the turn of the year, a week may be split.
    OR
    b) If January 1st does not coincide with the given start day of the
    week, the last days of the old year are already assigned to week 1 of
    the new year. In other words, at the turn of the year, each week number
    denotes a set of seven consecutive days.

    2) Would it be possible to improve clarity of the spec?

    Best regards
    Sebastian Schleich

    [1]
    https://docs.oasis-open.org/office/OpenDocument/v1.3/os/part4-formula/OpenDocument-v1.3-os-part4-formula.html#__RefHeading__1018212_715980110
    [2] https://bugs.documentfoundation.org/show_bug.cgi?id=112320#c9
    [3] https://bugs.documentfoundation.org/show_bug.cgi?id=112320#c13
    [4] https://bugs.documentfoundation.org/show_bug.cgi?id=162598#c5
    [5] https://bugs.documentfoundation.org/show_bug.cgi?id=170339#c3
    [6]
    https://learn.microsoft.com/de-de/power-platform/power-fx/reference/function-weeknum</sebastian.schleich@googlemail.com>