diff --git a/components/tvplanit/source/vpweekview.pas b/components/tvplanit/source/vpweekview.pas index c674f53c8..3c40c10b1 100644 --- a/components/tvplanit/source/vpweekview.pas +++ b/components/tvplanit/source/vpweekview.pas @@ -1129,7 +1129,11 @@ begin if (DataStore.Resource <> nil) then begin { otherwise, we must want to create a new event } StartTime := NextFullHour(FActiveDate + Time()); -// StartTime := trunc(Date) + 0.5; { default to 12:00 noon } + // Be careful: By taking the next full hour we may advance to the next day + // here which is very confusing to the user who had dbl-clicked on the + // previous day. In this case we go back by one hour (--> 23:00) + if trunc(StartTime) <> FActiveDate then + StartTime := StartTime - OneHour; EndTime := StartTime + 30 / MinutesInDay; { StartTime + 30 minutes } ActiveEvent := DataStore.Resource.Schedule.AddEvent( DataStore.GetNextID('Events'), @@ -1392,6 +1396,11 @@ begin Exit; StartTime := NextFullHour(Now()); { Default start time: next full hour } + // Be careful: By taking the next full hour we may advance to the next day + // here which is very confusing to the user who had clicked on the + // previous day. In this case we go back by one hour (--> 23:00) + if Trunc(StartTime) <> FActiveDate then + StartTime := StartTime - OneHour; EndTime := StartTime + 30 / MinutesInDay; { StartTime + 30 minutes } ActiveEvent := DataStore.Resource.Schedule.AddEvent( DataStore.GetNextID('Events'),