mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-11-04 07:59:34 +01:00 
			
		
		
		
	* Fixed TryStrToDateTime so it returns True only if both date and time are parsed successfully, resolves #17541.
git-svn-id: trunk@16099 -
This commit is contained in:
		
							parent
							
								
									69d85d5b2d
								
							
						
					
					
						commit
						6a9a991dca
					
				@ -1294,7 +1294,7 @@ var
 | 
			
		||||
  I: integer;
 | 
			
		||||
  dtdate, dttime :TDateTime;
 | 
			
		||||
begin
 | 
			
		||||
  result:=true;
 | 
			
		||||
  result:=false;
 | 
			
		||||
  I:=Pos(FormatSettings.TimeSeparator,S);
 | 
			
		||||
  If (I>0) then
 | 
			
		||||
    begin
 | 
			
		||||
@ -1307,6 +1307,7 @@ begin
 | 
			
		||||
          if not TryStrToTime(Copy(S,i+1, Length(S)-i),dttime,Formatsettings) then
 | 
			
		||||
            exit;
 | 
			
		||||
          Value:=ComposeDateTime(dtdate,dttime);
 | 
			
		||||
          result:=true;
 | 
			
		||||
        end
 | 
			
		||||
      else
 | 
			
		||||
         result:=TryStrToTime(s,Value,Formatsettings);
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user