View Issue Details

IDProjectCategoryView StatusLast Update
0033860FPCRTLpublic2018-06-28 15:38
ReporterLacaKAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilitysometimes
Status closedResolutionfixed 
Product Version3.0.4Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0033860: Backward compatibility broken in StrToDateTime()
DescriptionThere is in FPC 3.0.4 new function SplitDateTimeStr():
...
  //find separator
  if (FS.DateSeparator<>0000032) then
    begin
    while (p<Length(DateTimeStr)) and (not (DateTimeStr[p+1] in WhiteSpace)) do
      Inc(p);
    end
  else
    begin
    p:=Pos(FS.TimeSeparator, DateTimeStr);
    if (p<>0) then
      repeat
        Dec(p);
      until (p=0) or (DateTimeStr[p] in WhiteSpace);
    end;
...

which changed logic used in FPC 2.6.4:
(first find TimeSeparator and then scan backward until first white space is found)
  I:=Pos(FormatSettings.TimeSeparator,S);
  If (I>0) then
    begin
    While (I>0) and (S[I]<>' ') do
      Dec(I);
...
Steps To ReproduceIf format settings are: DateSeparator='. ' (dot+space) and TimeSeparator=':' which is default for example for Slovak Windows 7 then date and time parts are separated wrongly.
Additional InformationIf somebody will add into comments into header of SplitDateTimeStr() which formats should be supported then I will try to make patch. Now it is dificult for me as far as I do not know what should be supported and what not.
TagsNo tags attached.
Fixed in Revision39330
FPCOldBugId0
FPCTarget
Attached Files

Relationships

related to 0020522 resolvedMichael Van Canneyt TryStrToDateTime always fail when DateSeparator is same as TimeSeparator 

Activities

LacaK

2018-06-15 12:18

developer   ~0108916

IMO simple fix is sufficient:
821 - if (FS.DateSeparator<>0000032) then
821 + if pos(0000032, FS.DateSeparator)=0 then

Michael Van Canneyt

2018-06-28 14:43

administrator   ~0109114

Fixed as suggested.

Issue History

Date Modified Username Field Change
2018-06-14 13:33 LacaK New Issue
2018-06-14 13:35 LacaK Relationship added related to 0020522
2018-06-15 12:18 LacaK Note Added: 0108916
2018-06-28 14:21 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-06-28 14:21 Michael Van Canneyt Status new => assigned
2018-06-28 14:43 Michael Van Canneyt Fixed in Revision => 39330
2018-06-28 14:43 Michael Van Canneyt Note Added: 0109114
2018-06-28 14:43 Michael Van Canneyt Status assigned => resolved
2018-06-28 14:43 Michael Van Canneyt Fixed in Version => 3.1.1
2018-06-28 14:43 Michael Van Canneyt Resolution open => fixed
2018-06-28 14:43 Michael Van Canneyt Target Version => 3.2.0
2018-06-28 15:38 LacaK Status resolved => closed