mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-09 11:06:31 +02:00
* Make order of ISO8601ToDate consistent, ReturnUTC always at the end, and default true
git-svn-id: trunk@42800 -
This commit is contained in:
parent
2664a0a856
commit
f52b14ff3e
@ -453,9 +453,10 @@ Function TryISOTZStrToTZOffset(const TZ : String; Out TZOffset : Integer) : bool
|
||||
// ISO 8601 Date/Time formatting
|
||||
|
||||
function DateToISO8601(const ADate: TDateTime; AInputIsUTC: Boolean = True): string;
|
||||
Function ISO8601ToDate(const DateString: string; ReturnUTC : Boolean): TDateTime;
|
||||
Function ISO8601ToDateDef(const DateString: string; ReturnUTC : Boolean; aDefault : TDateTime): TDateTime;
|
||||
Function TryISO8601ToDate(const DateString: string; out ADateTime: TDateTime; ReturnUTC : Boolean) : Boolean;
|
||||
Function ISO8601ToDate(const DateString: string; ReturnUTC : Boolean = True): TDateTime;
|
||||
Function ISO8601ToDateDef(const DateString: string; ReturnUTC : Boolean; aDefault : TDateTime ): TDateTime; deprecated;
|
||||
Function ISO8601ToDateDef(const DateString: string; aDefault : TDateTime; ReturnUTC : Boolean = True ): TDateTime;
|
||||
Function TryISO8601ToDate(const DateString: string; out ADateTime: TDateTime; ReturnUTC : Boolean = True) : Boolean;
|
||||
|
||||
|
||||
implementation
|
||||
@ -2896,7 +2897,7 @@ begin
|
||||
Raise EConvertError.CreateFmt('Invalid ISO timezone string',[TZ]);
|
||||
end;
|
||||
|
||||
Function TryISO8601ToDate(const DateString: string; out ADateTime: TDateTime;ReturnUTC : Boolean) : Boolean;
|
||||
Function TryISO8601ToDate(const DateString: string; out ADateTime: TDateTime;ReturnUTC : Boolean = True) : Boolean;
|
||||
|
||||
|
||||
Var
|
||||
@ -2941,7 +2942,7 @@ begin
|
||||
Result:=True;
|
||||
end;
|
||||
|
||||
Function ISO8601ToDate(const DateString: string; ReturnUTC : Boolean): TDateTime;
|
||||
Function ISO8601ToDate(const DateString: string; ReturnUTC : Boolean = True): TDateTime;
|
||||
|
||||
begin
|
||||
if not TryISO8601ToDate(DateString,Result,ReturnUTC) then
|
||||
@ -2955,6 +2956,14 @@ begin
|
||||
Result:=aDefault;
|
||||
end;
|
||||
|
||||
Function ISO8601ToDateDef(const DateString: string; aDefault : TDateTime; ReturnUTC : Boolean = True): TDateTime;
|
||||
|
||||
begin
|
||||
if not TryISO8601ToDate(DateString,Result,ReturnUTC) then
|
||||
Result:=aDefault;
|
||||
end;
|
||||
|
||||
|
||||
{$else}
|
||||
implementation
|
||||
{$endif FPUNONE}
|
||||
|
Loading…
Reference in New Issue
Block a user