Reputation: 9935
I would like to use different TimeZone
base on the User's TimeZone
.
Question : Is there any feature to set default in JSF
or Seam
?
It will be effect the whole application.
I hope, the feature will be effect s:convertDateTime
, f:convertDateTime
, p:calendar
, etc... every time I use without using timezone
attribute.
I also tried to use Seam
component TimeZoneSelector
as below.
@In
private TimeZoneSelector timeZoneSelector;
....
timeZoneSelector.setTimeZone(user.getTimeZone());
But, it does not effect on <f:convertDateTime pattern="hh:mm a"/>
automatically.
I have to retrieve TimeZone
form backing bean again.
<f:convertDateTime pattern="hh:mm a" timeZone="#{mybean.timeZone}"/>
Upvotes: 0
Views: 274
Reputation: 271
1- create a default converter for java.util.Date
2- in the the getAsString
and getAsObject
have the converter retrieve the user timezone from the session
3- use SimpleDateFormat.setTimezone()
before parsing/formatting
Upvotes: 0
Reputation: 3671
JSF does not have default special feature allows you this. You need to take the implementation of this functional.
Upvotes: 1