On 18/09/17 16:20, Winfried Donkers wrote:
Hi Eike,
Hi Winfried
I'm working on tdf112320 and I think that ODFF1.2 may be ambiguous with
respect to WEEKNUM
(http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#WEEKNUM)
My interpretation of the Semantics for Mode 1,2,11-17 was that
'every week starts on Sunday..Saturday, depending on the value of Mode.
The week containing 1 January is week 1'.
Is this supposed to be analogous to the ISO week? Because that's
different again ...
ISO weeks start on Monday, finish on Sunday.
So, WEEKNUM(DATE(2014,12,29),1) returns 1, as it is a Monday, the week
starts on Sunday 28 December and 1 January is on the Thursday. All weeks
have 7 days.
However, both Excel and Gnumeric use
'every week starts on Sunday..Saturday, depending on the value of Mode,
_or_ on 1 January (with the week number 1)'.
So, WEEKNUM(DATE(2014,12,29),1) returns 53, as it is a Monday, following
week 52 and WEEKNUM(DATE(2015,1,1),1) returns 1. Week 53 has 4 days and
week 1 has 3 days.
When I read ODFF1.2 again (and again) I read the first interpretation
(WEEKNUM(DATE(2014,12,29),1)=1). But is that correct??
As it is now, Calc produces different results when compared to Excel and
Gnumeric.
What is your interpretation?
Winfried
ISO states that the week is Monday to Sunday, and it belongs to the year
in which the majority of it falls. (At least, I'm pretty certain it
does, I'd be rather shocked if somebody shows me otherwise.)
In practice, that means every Thursday will fall in its own year, so the
week number is equal to the count of Thursdays so far. If 31 Dec is a
Thursday, then 1,2,3 Jan will be week 53 of the previous year. If 1 Jan
is a Thursday, then 29,30,31 Dec will be week 1 of the following year.
There's some nifty code on a site called Pickwiki that calculates the
ISO weeknum based on this Thursday fact that I could point you to
(disclaimer, I wrote it), but the important point is that none of the
functions you have referenced appear to return the ISO weeknum.
Cheers,
Wol
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.