Backward compatibility broken in StrToDateTime()
Original Reporter info from Mantis: lacak @lacak.sk
-
Reporter name: LacaK
Original Reporter info from Mantis: lacak @lacak.sk
- Reporter name: LacaK
Description:
There is in FPC 3.0.4 new function SplitDateTimeStr():
...
//find separator
if (FS.DateSeparator<>#32) 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 reproduce:
If 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 information:
If 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.
Mantis conversion info:
- Mantis ID: 33860
- Version: 3.0.4
- Fixed in version: 3.1.1
- Fixed in revision: 39330 (#58b480e0)
- Target version: 3.2.0