Issue with time zone id in UsersEdit.getTimeZone()

Hi, thanks for the support

we need to get time zone of user when they log in and change it for creating an object with type OffsetDateTime, using the method

public static OffsetDateTime ofInstant(Instant instant, ZoneId zone) in OffsetDateTime

and passing public static ZoneId of(String zoneId) in ZoneId as zoneId
the zoneId is obtained from the user by
getUserSession().getUser().getTimeZone() in UserSessionSource
but this method don’t return a supported zoneId

Hi,
You can get ZoneId from TimeZone using toZoneId(), e.g.

getUserSession().getUser().getTimeZone().toZoneId()

1 Like