My browser is in Eastern Timezone but I want to show the date times in a different timezone. I am using the DateUtil.setDefaultDisplayTimezone which does effect the time being selected so that it is in the timezone set by that method, however the display still shows the value in the browser's local timezone.
For example, If i pick Jan 1st: 00:00 using the code below and setDefaultDisplayTimezone("-07:00") with my browser in Eastern Timezone, then the inputted date time is correct but it displays with timezone -5 and not -7.
Likewise if I pick a date within DST such as Sept 1 00:00 then again it shows in browser relative Timezone of -4 instead of -6.
How do i get the components to display in the Timezone that was set with setDefaultDisplayTimezone?
Using: SmartClient Version: v10.1p_2015-12-18/Pro Deployment (built 2015-12-18)
For example, If i pick Jan 1st: 00:00 using the code below and setDefaultDisplayTimezone("-07:00") with my browser in Eastern Timezone, then the inputted date time is correct but it displays with timezone -5 and not -7.
Likewise if I pick a date within DST such as Sept 1 00:00 then again it shows in browser relative Timezone of -4 instead of -6.
How do i get the components to display in the Timezone that was set with setDefaultDisplayTimezone?
Using: SmartClient Version: v10.1p_2015-12-18/Pro Deployment (built 2015-12-18)
Code:
public void onModuleLoad() { final DateTimeFormat dateTimeFormat = DateTimeFormat.getFormat("yyyy-MM-dd HH:mm:ss Z"); DateUtil.setShortDatetimeDisplayFormatter(new DateDisplayFormatter() { public String format(Date date) { if (date == null) return null; String formattedDate = dateTimeFormat.format(date); return formattedDate; } }); DateUtil.setDateParser(new DateParser() { public Date parse(String dateString) { return dateTimeFormat.parse(dateString); } }); DateUtil.setDefaultDisplayTimezone("-07:00"); HLayout layout = new HLayout(); DynamicForm form = new DynamicForm(); RelativeDateItem date1 = new RelativeDateItem("date_1"); RelativeDateItem date2 = new RelativeDateItem("date_2"); date1.setTitle("Date_1"); date2.setTitle("Date_2"); form.setFields(date1, date2); layout.addMember(form); layout.draw(); }
Comment