[fpc-pascal] Regression in StrToDateTime()
LacaK
lacak at zoznam.sk
Thu Jun 14 13:36:08 CEST 2018
> You also can make your own procedure to fix the issue for yourself.
> Like you can rewrite the function StrToDateTime() to change all '. '
> to '.' and then call the original function StrToDateTime()
Of course it is possible, but IMO it should be fixed in general way. I
have reported bug #33860
I can prepare think about patch, but I must know what situations,
formats must be supported by SplitDateTimeStr() and what is expected output.
(this should be documented is source code)
L.
>
>
> On Thu, 14 Jun 2018, LacaK wrote:
>
>> Hi,
>>
>> now I am migrating my applications from FPC 2.6.4 to FPC 3.0.4 and I
>> noticed that logic in function StrToDateTime() was changed.
>>
>> In 2.6.4 there was first detected position of first TimeSeparator and
>> then walking back to first occurence of WhiteSpace.
>> This approach allows DateSeparator='. ' (dot+space) which is for
>> example default settings in Windows7 in Slovak language
>> (TimeSeparator=':').
>>
>> Now in FPC 3.0.4 firs occurence of space causes division of date and
>> time. It results in where:
>> '11. 07. 2018 13:00' is divided to date part = '11.' and time
>> part='07. 2018' which is wrong.
>>
>> 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;
>> ...
>>
>> In first part of code is located first occurnce of white space, which
>> is also part of DateSeparator!
>> Can this be to fixed ?
>>
>> L.
>>
>> _______________________________________________
>> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
>> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>
>
> _______________________________________________
> fpc-pascal maillist - fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20180614/1111d8f1/attachment.html>
More information about the fpc-pascal
mailing list