When I change timeZone of f:convertDateTime this doesn´t change.
`<p:dataTable id="tabla2" value="#{bb.dataTable}" var="trm" resizableColumns="true"
style="width : 1400px" editable="true" editMode="cell"
rowStyleClass="#{styleController.daColoresParaEstadoTramos(trm, bb.fechaInicio)}"><p:column>
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{trm.tramo.horaDespeguePrevista}">
<f:convertDateTime pattern="HH:mm" timeZone="#{bb.zonaH}" />
</h:outputText>
</f:facet>
<f:facet name="input">
<p:inputMask value="#{trm.tramo.horaDespeguePrevista}" mask="99:99" >
<f:convertDateTime pattern="HH:mm" timeZone="#{bb.zona}" />
</p:inputMask>
</f:facet>
</p:cellEditor>
</p:column></p:dataTable>`
zone is a element java.util.TimeZone. I use primefaces 3.5
I've just solved a similar problem on my app. The issue is with the JSF lifecycle. Like you I was taking a collection of objects and using f:convertDateTime for a Date on each, using a timezone value (I'm showing bookings for various locations around the world).
Setting a breakpoint in the getter for my list of bookings and another in the ConvertDateTimeHandler I could see that JSF was tring to convert the date before I had even got the bookings from the backing bean.
I was using a ui:repeat and was able to resolve the issue by switching to using c:forEach from JSTL.
You may be able to do something similar if you don't have to have the Primefaces datatable. Otherwise you may be better off having a transient getter which returns a String of the date already formatted for the timezone in question.
A quick way to prove this would be to get the first object in your collection and put it through an h:outputText along with the f:convertDateTime. If it converts correctly then try an alternative to datatable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With