Hi I try make schedule using primaface but the end date showing one day before the specified date
And this bean
@PostConstruct
public void init() {
eventModel = new DefaultScheduleModel();
lazyEventModel = new LazyScheduleModel() {
@Override
public void loadEvents(Date start, Date end) {
List<Group> listproject = new GroupDAO().retriveAll("", new Object[] {});
Calendar date = Calendar.getInstance();
Calendar dates = Calendar.getInstance();
for (int i = 0; i < listproject.size(); i++) {
date.setTime(listproject.get(i).getCreateAt());
dates.setTime(listproject.get(i).getUpdateAt());
addEvent(new DefaultScheduleEvent(listproject.get(i).getName(), date.getTime(), dates.getTime()));
System.out.println(listproject.get(i).getName()+ listproject.get(i).getCreateAt() + listproject.get(i).getUpdateAt());
}
}
};
}
The Xhtml
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://java.sun.com/jsf/core"
template="/user_templates/template.xhtml">
<ui:define name="metadata">
</ui:define>
<ui:define name="content">
<p:layout>
<p:layoutUnit position="center">
<h:form id="formId">
<h:panelGrid columnClasses="value">
<p:schedule value="#{testBean.lazyEventModel}" timeZone="GMT+7" > <!-- view="agendaWeek" bisa dipake buat search -->
<p:ajax event="dateSelect" listener="#{testBean.onDateSelect}" update="eventDetails" oncomplete="PF('eventDialog').show()" />
<p:ajax event="eventSelect" listener="#{testBean.onEventSelect}" update="eventDetails" oncomplete="PF('eventDialog').show()" />
</p:schedule>
</h:panelGrid>
<p:dialog widgetVar="eventDialog" header="Event Details" showEffect="clip" hideEffect="clip">
<h:panelGrid id="eventDetails" columns="2">
<p:outputLabel for="title" value="Titles:" />
<p:inputText id="title" value="#{testBean.event.title}" required="true" />
<p:outputLabel for="from" value="From:" />
<p:calendar id="from" value="#{testBean.event.startDate}" pattern="dd/MM/yyyy HH:mm" showTime="true" appendTo="@(body)" />
<p:outputLabel for="to" value="To:" />
<p:calendar id="to" value="#{testBean.event.endDate}" pattern="dd/MM/yyyy HH:mm" showTime="true" appendTo="@(body)" />
<!-- <p:outputLabel for="allDay" value="All Day (see #1164):" />
<h:selectBooleanCheckbox id="allDay" value="#{testBean.event.allDay}" /> -->
<p:commandButton type="reset" value="Reset" />
<p:commandButton id="addButton" value="Save" action="#{testBean.addEvent}" oncomplete="PF('myschedule').update();PF('eventDialog').hide();" />
</h:panelGrid>
</p:dialog>
</h:form>
</p:layoutUnit>
</p:layout>
</ui:define>
previously I used Date for set value on cratedAt and updateAt on GroupDAO for get value from database but it show same thing like the picture for the start date and then I change it into Timestamp, and the star date showing like I want but the end date showing like that, and I don't know the problem is
And I just realized just that value have wrong end date