View Issue Details

IDProjectCategoryView StatusLast Update
0038290FPCOtherpublic2021-01-24 17:38
ReporterJürgen Zier Assigned ToFlorian  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Summary0038290: Error in StartOfAWeek and EndOfAWeek if YEAR = 2021 and CW = 53
DescriptionI will set a datefield to the first date of the week and the next datefield to the last day of the week.
If year = 2021 and calendar week = 53 then I get this error:
StartOfAWeek ( tmp_Jahr, tmp_KW ); -> 2021 53 1 is not a valid dateweek
EndOfAWeek ( tmp_Jahr, tmp_KW ); -> 2021 53 7 is not a valid dateweek
Steps To ReproduceMy code:
...
var
   tmp_Jahr: word;
   tmp_KW: word;
begin
   tmp_Jahr := 2021;
   tmp_KW := 53;
   DateTimePicker1.Date := StartOfAWeek ( tmp_Jahr, tmp_KW );
   DateTimePicker2 := EndOfAWeek ( tmp_Jahr, tmp_KW );
end;
Additional InformationIf I set tmp_Jahr to 2020 and tmp_KW to 53 it works fine.
TagsNo tags attached.
Fixed in Revision
FPCOldBugId
FPCTarget-
Attached Files

Activities

Jürgen Zier

2021-01-02 09:48

reporter   ~0128015

Error in Code copy, must be
DateTimePicker2.Date := EndOfAWeek ( tmp_Jahr, tmp_KW );

Bart Broersma

2021-01-02 16:20

reporter   ~0128024

These functions are part of FPC.
Moving...

Zoran Vučenović

2021-01-22 10:55

reporter   ~0128482

There are only 52 weeks in 2021 (in 2020 there were 53).
See here:
https://www.epochconverter.com/weeks/2020
https://www.epochconverter.com/weeks/2021

So, the functions work as expected and they return the correct error message.

Florian

2021-01-24 17:38

administrator   ~0128563

Indeed, 2021 has only 52 weeks. If you think otherwise, please provide some reference, even Outlook agrees on 52 weeks :)

Issue History

Date Modified Username Field Change
2021-01-02 09:43 Jürgen Zier New Issue
2021-01-02 09:48 Jürgen Zier Note Added: 0128015
2021-01-02 16:20 Bart Broersma Note Added: 0128024
2021-01-02 16:20 Bart Broersma Project Packages => FPC
2021-01-22 10:55 Zoran Vučenović Note Added: 0128482
2021-01-24 17:38 Florian Assigned To => Florian
2021-01-24 17:38 Florian Status new => resolved
2021-01-24 17:38 Florian Resolution open => no change required
2021-01-24 17:38 Florian FPCTarget => -
2021-01-24 17:38 Florian Note Added: 0128563