WoY() - Harbour bug
Posted: Thu Dec 15, 2016 12:01 am
Hi all, this is to inform we have found a bug in WoY() which is used to get the week number of the year for a given date.
Its syntax is: WoY( <dDate>, <lIso> ) -> nWeek
It's wrongly returning as week number 2. If you check in the 2017 calendar you will see that the right is week # 1.
Day 7 of January of 2017. Would it be the first week of the year by given that the week starts on Sunday. This was announced by Eduardo in this post. Others dates also can be with wrong result (for sure).
I found the probable error in the C function at:
I have translated all C functions envolved to PRG in case of replacement and my better understanding of the code.
I have already announced this bug at Harbour forum and we shall wait their return and fixing. Otherwise, we could provide the substitute function to fix this problem.
Keeping our community informed.
Its syntax is: WoY( <dDate>, <lIso> ) -> nWeek
But in this sample:It returns ISO-based week number, i.e. in range 0..52, by default (or passing TRUE as second parameter), or in range 1..52 if lIso is FALSE.
Code: Select all
Function Main
MsgBox(WoY(hb_CtoD("07-01-2017","dd-mm-yyyy"))) // 2 ?
Return
Day 7 of January of 2017. Would it be the first week of the year by given that the week starts on Sunday. This was announced by Eduardo in this post. Others dates also can be with wrong result (for sure).
I found the probable error in the C function at:
I have translated all C functions envolved to PRG in case of replacement and my better understanding of the code.
I have already announced this bug at Harbour forum and we shall wait their return and fixing. Otherwise, we could provide the substitute function to fix this problem.
Keeping our community informed.