I'm using ZK CE-9.0.0 & zk-calendar-2.1.5 source code.
Whenever I open the calendar by default it displays today/current week/current month as per its mold. If I want to navigate to other day/week/month, I have to use the buttons provided.
My requirement is, it should display the day/week/month specified by my program. Specified date can be in future or in past. That should be displayed by default. Can anyone tell me how can I achieve this?
Thanks,
RAS
ZK Calendar can be initialized as explained on the first page (2nd paragraph) of ZK Calendars Essentials
E.g. you can switch to the month view by calling:
calendars.setMold("month");
or specify a 7-days-view by calling:
calendars.setMold("default");
calendars.setDays(7);
The current date can be set by:
calendars.setCurrentDate(aDate);
Please also refer to the zk calendar javadocs
UPDATE:
Here a runnable piece of code setting the current date to something different than today using setCurrentDate
(as mentioned above):
<?import java.text.*?>
<zk>
<calendars id="cal"/>
<zscript><![CDATA[
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
cal.setCurrentDate(sdf.parse("2019-01-14"));
Clients.log("displaying from " + cal.getBeginDate() + " to " + cal.getEndDate());
]]></zscript>
</zk>
The calendar then shows the current week around this date. The same will happen for the month view.