Skip to content

Commit

Permalink
Support for TSQLTimestampOffset in datetimetostr
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleteti committed Jan 7, 2025
1 parent 75df5b8 commit 51288f8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions sources/TemplatePro.pas
Original file line number Diff line number Diff line change
Expand Up @@ -1957,6 +1957,8 @@ function TTProCompiledTemplate.ExecuteFilter(aFunctionName: string; var aParamet
lNullableDate: NullableTDate;
lValue, lVarValue: TValue;
lExtendedValue: Extended;
lSQLTimestampOffset: TSQLTimeStampOffset;

procedure CheckParamType(const FunctionName: String; const FilterParameter: PFilterParameter; const Types: TFilterParameterTypes);
begin
if not(FilterParameter.ParType in Types) then
Expand Down Expand Up @@ -2226,6 +2228,17 @@ function TTProCompiledTemplate.ExecuteFilter(aFunctionName: string; var aParamet
Result := FormatDateTime(aParameters[0].ParStrText, lDateValue);
end;
end
else if aValue.TryAsType<TSQLTimeStampOffset>(lSQLTimestampOffset) then
begin
lDateValue := SQLTimeStampOffsetToDateTime(lSQLTimestampOffset);
if Length(aParameters) = 0 then
Result := DateTimeToStr(lDateValue, fLocaleFormatSettings)
else
begin
CheckParNumber(1, aParameters);
Result := FormatDateTime(aParameters[0].ParStrText, lDateValue);
end;
end
else
begin
FunctionError(aFunctionName, 'Invalid datetime ' + aValue.AsString.QuotedString);
Expand Down

0 comments on commit 51288f8

Please sign in to comment.