item ends on midnight

I am using the planner for planning staff in a theater. The staff often start work a say 6pm and finish at midnight or in the early hours of the next day. When an item that ends at midnight is drawn on the planner, it shows as ending at midnight of the next day. For example an item that runs from 6pm Monday to 12pm Monday covers Monday and Tuesday when shown on the planner. 


So, Is there a way to make the planner see midnight (itemendtime = 0) as 'belonging' to the previous day? I have tried checking for itemendtime = 0 and changing that to 0 - 0.0000001. This works but then messes up anything else that reads the end time such as calculating total work hours.

A more generic version of this request would be: could it be possible to set a day start time? This would allow us to show shifts that start Monday evening and end in the early hours of Tuesday as still just being on Monday.

David Wilbourn

Are you using the latest version of this component?
I have retested this here with a default TPlanner on the form and initialized with:


begin
  planner1.Display.DisplayEnd := 54;

  with planner1.CreateItem do
  begin
    itemstarttime := encodetime(19,0,0,0) + encodedate(2013,2,11);
    itemendtime :=  encodetime(02,0,0,0) + encodedate(2013,2,12);
  end;
end;

and this correctly shows the item from 19h , crossing 0h00 and ending at 02h00.

It is also correctly ending at 0h00 when I use the code:

begin
  planner1.Display.DisplayEnd := 54;

  with planner1.CreateItem do
  begin
    itemstarttime := encodetime(19,0,0,0) + encodedate(2013,2,11);
    itemendtime :=  encodetime(02,0,0,0) + encodedate(2013,2,12);
  end;
end;

What is different in your project?

Hi Bruno,


Perhaps I did not explain this very well....

Your code is quite correct - the problem (for me) is if the item ends at midnight. Most people want to put this as "00:00". But this is technically the start of the next day, not the end of the current day. So with a Planner set to show days, and an item starting at 8PM and ending at 12PM, the item visually shows as spanning two days.

At the moment I am doing all sorts of juggling to convert any "00:00" times to "23:59" of the previous day so that the item is only drawn over one day (and then converting them back to 00:00 for text displays)

I realise that this is logically correct but visually it is not. Also I think there must be lots of similar situations such as appointment diaries - no-one is going to say an appointment runs from 9AM to 9:59AM, but if you use 09:00 to 10:00 the appointment is technically ending in the 10 to 11 'block'.

David.

P.S. Sorry for the delay - I forgot to turn 'Notify' on...


sorry, I still don't understand it.
I retested this here with:


  planner1.Display.DisplayEnd := 54;

  with planner1.CreateItem do
  begin
    itemstarttime := encodetime(19,0,0,0) + encodedate(2013,2,19);
    itemendtime :=  encodetime(0,0,0,0) + encodedate(2013,2,20);
  end;

and it shows the item from 19h00 to 0h00. Technically, midnight today (Feb 19) is 0h00 Feb 20, day lapse is at 0h00

I cannot see such items spanning 2 days. Are you using the latest version v3.0.3.3 of TPlanner?

I am on v3.0.0.9 at the moment... I will try to get updated and see what happens then.


Thanks for the support!