gantt icon indicating copy to clipboard operation
gantt copied to clipboard

UTC support

Open lrozenblyum opened this issue 8 years ago • 4 comments

Reproduced in 0.9.3 not in 0.9.1 While it's nice that Gantt supports custom timezones now, it's an issue it doesn't support UTC anymore. gantt.setTimeZone( TimeZone.getTimeZone("UTC") ); will throw an exception

It is possible to avoid dependency on TimeZoneConstants.properties at all? java has https://docs.oracle.com/javase/8/docs/api/java/util/TimeZone.html#getAvailableIDs-- we could rely always on. Thanks.

Corresponding part of stack trace:

Caused by: java.lang.IllegalArgumentException: Time zone UTC not found in TimeZoneConstants.properties at org.tltv.gantt.Gantt.getTimeZoneJson(Gantt.java:899) at org.tltv.gantt.Gantt.updateTimezoneOffsets(Gantt.java:794) at org.tltv.gantt.Gantt.updateTimelineStartTimeDetails(Gantt.java:781) at org.tltv.gantt.Gantt.setStartDate(Gantt.java:188) ... .... at com.vaadin.ui.UI.accessSynchronously(UI.java:1381) at com.vaadin.ui.UI$3.run(UI.java:1447)

lrozenblyum avatar Apr 08 '16 08:04 lrozenblyum

Unfortunately TimeZoneConstants.properties doesn't support UTC by default.

Dependency is there to produce GWT friendly json for timezone and send it to client for further usage. You can override TimeZoneConstants completely and populate timezone json for any zone id by your self. That you can do by overriding Gantt.getTimeZoneJson(String id). Returned json has to respect the same format that is used in TimeZonteConstants.properties file.

You can also change the properties file by overriding createTimeZonePropertiesInputStream( String propertiesFileName).

Dependency to TimeZoneConstants class will still stay, but TimeZoneConstants.properties file dependency can be removed by overriding one of those methods.

tltv avatar Apr 08 '16 09:04 tltv

thank you very much tor the explanation! It's nice that the TimeZoneConstants.properties is now part of the Gantt itself, so it's more obvious for non-GWT-gurus what's going on.

lrozenblyum avatar Dec 20 '16 20:12 lrozenblyum

Hi @lrozenblyum , do you have example code of Gantt.getTimeZoneJson(String id) override to share with us 👼 ?

dyorgio avatar Feb 09 '18 13:02 dyorgio

Hi @dyorgio. Unfortunately no, we haven't override this yet. At the moment we disabled possibility to work in UTC with the Gantt because our usage scenarios allowed to do that based on real customer experience. For sure it's not an elegant solution...

lrozenblyum avatar Feb 10 '18 20:02 lrozenblyum