create dynamic datepicker button

Hi,
Is it possible to create a dynamic datepicker button which will take the date on step back, each time it is being pressed?

I’ve been trying to create it for over three days now, but i can’t seem to get this work…

What i’ve got so var is this:

var dayback = day()-1;

$$(“Dayback”).attachEvent(“onItemClick”,function(id){
$$(“date”).refresh();
$$(“date”).setValue(dayback+"."+month+"."+year);

it will only allow me to change the date back one day, and not more when clicked multiple times…

Thnx in advance for your help!

Hi,

here is method to get day back date:

var dayback = dhx.Date.add(currentDate,-1, “day”);

Here currentDate and dayback are instances of JS Date object.