Bug in PlannerItem DateTime

When you set the date of the TPlanner to f.e. 18 april 2014 and add a PlannerItem with a start time of "17 april 2014 12:00" the item starts at "18 april 2014 12:00" instead of the expected "18 april 2014 0:00".

Can you please provide more details?

In what mode is your Planner?

Since I cannot attach a zip with sources, this is what I do.

File->New->VCL Forms Application

- Add a TDateTimePicker and a TPlanner on the form;

- Only property changed on the Planner is the Anchors so it will resize with the form;

- Renamed the TDateTimePicker to DTP.

Hook up the following code:


unit Unit1;


uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ComCtrls, Planner;

type TForm1 = class(TForm)

DTP: TDateTimePicker;

Planner1: TPlanner;  

procedure DTPChange(Sender: TObject);

procedure FormCreate(Sender: TObject);


procedure AddPlannerItems;

function GetPlannerDate: TDateTime;

procedure SetPlannerDate(const Value: TDateTime);


property PlannerDate: TDateTime read GetPlannerDate write SetPlannerDate;



Form1: TForm1;


uses System.UITypes, System.DateUtils;

{$R *.dfm}

procedure TForm1.AddPlannerItems;


Item: TPlannerItem;





Item := Planner1.CreateItem;

Item.Color := TColors.Green;

Item.ColorTo := TColors.Yellow;

Item.Background := True;

Item.Shadow := True;

Item.ItemStartTime := EncodeDateTime(2014, 4, 18, 12, 0, 0, 0);

Item.ItemEndTime := EncodeDateTime(2014, 4, 27, 18, 0, 0, 0);

Item.ItemPos := 1;

Item.Text.Add('An Item');





procedure TForm1.DTPChange(Sender: TObject);


PlannerDate := DTP.Date;


procedure TForm1.FormCreate(Sender: TObject);


PlannerDate := DTP.Date;


function TForm1.GetPlannerDate: TDateTime;

begin Result := Planner1.Mode.Date;


procedure TForm1.SetPlannerDate(const Value: TDateTime);


Planner1.Mode.Date := Value;

Planner1.Caption.Title := Format('Date: %s', [DateToStr(Value)]);





I see that you programmatically set in your code PlannerItem.ItemPos. That means it overwrites the day position that was otherwise automatically retrieved from the PlannerItem.ItemStartTime.
When I remove this line and select date Apr 18, the item is added at Apr 18.

When I get rid of the ItemPos assignment I don't see the item at all. ItemPos is updated when the mode is plMultiMonth, not in others. As I said this is the default config so the mode is plDay.

When I need to assign the item to a certain person/activity/whatever I need to set the ItemPos to a certain row/column. The ItemPos is updated hardcoded in this example, but in the real program it is calculated on the basis of what I am trying to show as assigned (person, location, etc.).

If you use columns as resources, I'd assume your Planner represents only a single day and when this is the case, it only makes sense to add PlannerItems allocated to the displayed date.

Gladly I refer you back to the original post and the accompanying source example, so we can return to the bug at hand.

Now that we established that the TPlanner is in plDay mode (which it is by default), and the date is set to April the 25th, and we have an Item that is retrieved from somewhere that spans from April the 18th to the 27th (as in the example).... How should that item be drawn on the TPlanner? From 12:00? Or from 00:00 seeing as it started 6.5 days earlier?

Oops!!!!!! I just notice that I posted this thread in the wrong forum!!!! I am talking about the "plain TPlanner", not the IntraWeb one!

Sorry if that causes/caused confusion.

Multi day items are normally shown in the header (the DBPlanner does this automatically)

You can make the item a multiday header item by setting item.InHeader = true.
Make sure to provide sufficient header area space for this. You might have to increase Planner.Header.Height

I think filling the entire day in the column is easier to see. When I don't set the Item.InHeader it still should fill the entire day and not a part of it.

Then I'd suggest to set the event's start & end time via PlannerItem.ItemRealStartTime, PlannerItem.ItemRealEndTime and set the position of the item on the Planner with PlannerItem.ItemBegin / PlannerItem.ItemEnd.

When I set the InHeader to True, this will show just a small entry in the header (as expected). On the first and last day which is a partial day this will also show the small "Header entry", not the part of the day that it occupies.

Sort of related, when I use the same sample code I posted earlier, setting the date to April 2 will show the Item as well. This would be another bug as the item doesn't fall on April 2...

In the non DB-aware Planner, you are responsible for adding only the items that should be displayed (as opposed to the DB-aware Planner where it is the DB Planner that performs this filtering)