tltv / gantt

Gantt Chart Add-on for Vaadin 8
Apache License 2.0
20 stars 23 forks source link

UTC support #38

Open lrozenblyum opened 8 years ago

lrozenblyum commented 8 years ago

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)

tltv commented 8 years ago

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.

lrozenblyum commented 7 years ago

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.

dyorgio commented 6 years ago

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

lrozenblyum commented 6 years ago

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...