Page 1 of 1

Fixes for TZAbstractTimestampFormatSettings

Posted: 03.04.2021, 11:48
by MJFShark
The SetDateFormat and SetTimeFormat procedures use FFormat instead of either FDateFormat or FTimeFormat. Here are the fixed versions:

Code: Select all

procedure TZAbstractTimestampFormatSettings.SetDateFormat(const Value: String);
begin
  if ((FDateFormat = nil) and (Value <> '')) or ((FDateFormat <> nil) and (Value = '')) or ((FDateFormat <> nil) and (FDateFormat^ <> Value)) then begin
    if Value <> '' then begin
      FDateFormat := @FFormatSettings.ShortDateFormat;
      FDateFormat^ := Value;
    end else FDateFormat := nil;
    if Assigned(FOnFormatChanged) then
      FOnFormatChanged;
  end;
end;

procedure TZAbstractTimestampFormatSettings.SetTimeFormat(const Value: String);
begin
  if ((FTimeFormat = nil) and (Value <> '')) or ((FTimeFormat <> nil) and (Value = '')) or ((FTimeFormat <> nil) and (FTimeFormat^ <> Value)) then begin
    if Value <> '' then begin
      FTimeFormat := @FFormatSettings.ShortTimeFormat;
      FTimeFormat^ := Value;
    end else FTimeFormat := nil;
    if Assigned(FOnFormatChanged) then
      FOnFormatChanged;
  end;
end;
Thanks!

-Mark

Re: Fixes for TZAbstractTimestampFormatSettings

Posted: 05.04.2021, 11:48
by marsupilami
Hello Mark,

I applied your patch. Having a patch file or a pull request really helps ;)

Bets regards,

Jan

Re: Fixes for TZAbstractTimestampFormatSettings

Posted: 05.04.2021, 12:11
by MJFShark
Hi Jan,

Sorry for that! I'll use one of those methods for future stuff.

-Mark