tvplanit: Fix incorrect handling of overnight events.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4869 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2016-06-29 21:34:45 +00:00
parent de22b0fbbd
commit 454c96067c
2 changed files with 24 additions and 1 deletions

View File

@ -254,7 +254,28 @@ end;
{=====} {=====}
procedure TDlgEventEdit.OKBtnClick(Sender: TObject); procedure TDlgEventEdit.OKBtnClick(Sender: TObject);
var
res: Integer;
tStart, tEnd, t: TDateTime;
begin begin
tStart := StartDate.Date + StartTime.Time;
tEnd := EndDate.Date + EndTime.Time;
if (tStart > tEnd) then begin
res := MessageDlg('Incorrect order of start and end times. Do you want to flip them?',
mtConfirmation, [mbYes, mbNo], 0);
if res = mrYes then begin
t := tStart;
tStart := tEnd;
tEnd := t;
StartDate.Date := trunc(tStart);
StartTime.Time := frac(tStart);
EndDate.Date := trunc(tEnd);
EndTime.Time := frac(tEnd);
end else
exit;
end;
ReturnCode := rtCommit; ReturnCode := rtCommit;
Close; Close;
end; end;
@ -436,6 +457,7 @@ begin
end; end;
StartTime.Color := clWindow; StartTime.Color := clWindow;
(*
{ if the end time is less than the start time then change the end time to } { if the end time is less than the start time then change the end time to }
{ follow the start time by 30 minutes } { follow the start time by 30 minutes }
if ST > StrToTime(EndTime.Text) then begin if ST > StrToTime(EndTime.Text) then begin
@ -444,6 +466,7 @@ begin
else else
EndTime.Text := FormatDateTime('hh:nn AM/PM', ST + 30 / MinutesInDay); EndTime.Text := FormatDateTime('hh:nn AM/PM', ST + 30 / MinutesInDay);
end; end;
*)
end; end;
{=====} {=====}