You've already forked lazarus-ccr
Improving detection of default date display order.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2854 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1636,29 +1636,55 @@ end;
|
|||||||
procedure TCustomZVDateTimePicker.AdjustEffectiveDateDisplayOrder;
|
procedure TCustomZVDateTimePicker.AdjustEffectiveDateDisplayOrder;
|
||||||
var
|
var
|
||||||
S: String;
|
S: String;
|
||||||
I: Integer;
|
I, J, Le: Integer;
|
||||||
|
InQuoteChar: Char;
|
||||||
begin
|
begin
|
||||||
if FDateDisplayOrder = ddoTryDefault then begin
|
if FDateDisplayOrder = ddoTryDefault then begin
|
||||||
S := DefaultFormatSettings.ShortDateFormat;
|
S := DefaultFormatSettings.ShortDateFormat;
|
||||||
FEffectiveDateDisplayOrder := ddoTryDefault;
|
FEffectiveDateDisplayOrder := ddoTryDefault;
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
|
InQuoteChar := Chr(0);
|
||||||
|
Le := Length(S);
|
||||||
|
|
||||||
|
I := 0;
|
||||||
|
while I < Le do begin
|
||||||
|
Inc(I);
|
||||||
|
if InQuoteChar = Chr(0) then begin
|
||||||
|
case S[I] of
|
||||||
|
'''', '"':
|
||||||
|
InQuoteChar := S[I];
|
||||||
|
'D', 'd':
|
||||||
|
begin
|
||||||
|
{ If 3 or more "d"-s are standing together, then it's day
|
||||||
|
of week, but here we are interested in day of month.
|
||||||
|
So, we have to see what is following: }
|
||||||
|
J := I + 1;
|
||||||
|
while (J <= Le) and (upCase(S[J]) = 'D') do
|
||||||
|
Inc(J);
|
||||||
|
|
||||||
|
if J <= I + 2 then begin
|
||||||
|
FEffectiveDateDisplayOrder := ddoDMY;
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
|
||||||
|
I := J - 1;
|
||||||
|
end;
|
||||||
|
'M', 'm':
|
||||||
|
begin
|
||||||
|
FEffectiveDateDisplayOrder := ddoMDY;
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
'Y', 'y':
|
||||||
|
begin
|
||||||
|
FEffectiveDateDisplayOrder := ddoYMD;
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end else
|
||||||
|
if S[I] = InQuoteChar then
|
||||||
|
InQuoteChar := Chr(0);
|
||||||
|
|
||||||
for I := 1 to Length(S) do begin
|
|
||||||
case upCase(S[I]) of
|
|
||||||
'D': begin
|
|
||||||
FEffectiveDateDisplayOrder := ddoDMY;
|
|
||||||
Break;
|
|
||||||
end;
|
|
||||||
'M': begin
|
|
||||||
FEffectiveDateDisplayOrder := ddoMDY;
|
|
||||||
Break;
|
|
||||||
end;
|
|
||||||
'Y': begin
|
|
||||||
FEffectiveDateDisplayOrder := ddoYMD;
|
|
||||||
Break;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if FEffectiveDateDisplayOrder = ddoTryDefault then begin
|
if FEffectiveDateDisplayOrder = ddoTryDefault then begin
|
||||||
|
Reference in New Issue
Block a user