Skip to content

Different setups for projects using gwt time

Stanislav Spiridonov edited this page Feb 5, 2021 · 3 revisions

Available feature configurations

gwt-time is separate into several modules:

  • gwt-locale - java.util.Locale emulation, required (used internally, because some methods take java.util.Locale as a parameter)
  • gwt-locale-cldr - contains the actual CLDR locale list
  • TZDB loader - contains the actual zone information (TZDB)
Base time TZDB CLDR locales Size difference
+0kB
+10kB
+92kB
+102kB

For the general users, I recommend using the full set (TZDB + CLDR locales)

Base set

To use base java.util.time classes, you need to add the following dependency:

<dependency>
    <groupId>org.jresearch.gwt.time</groupId>
    <artifactId>org.jresearch.gwt.time</artifactId>
</dependency>

It will enable all java.util.time classes including zone offset classes and base locales (18 locales) from java.util.Locale class. See demo.time01 module for the complete example.

Action Result
Time works yes
Zone works no
Locale.getAvailableLocales() 19 (base + CLDR)
DecimalStyle.getAvailableLocales() 18 (supported by browser Intl implementation)
DateTimeFormatStyleProvider.getAvailableLocales() 18 (supported by browser Intl implementation)
It is a minimal set. In the demo application, it takes 205kB (1.3MB uncompressed)

Base set with CLDR locations

To use base java.util.time classes and all CLDR location, you need to add the following dependency:

<dependency>
	<groupId>org.jresearch.gwt.locale</groupId>
	<artifactId>org.jresearch.gwt.locale.cldr</artifactId>
</dependency>
<dependency>
	<groupId>org.jresearch.gwt.time</groupId>
	<artifactId>org.jresearch.gwt.time</artifactId>
</dependency>

It will enable all java.util.time classes including zone offset classes, base locales (18 locales) from java.util.Locale class, plus all CLDR locales. See demo.time02 module for the complete example.

Action Result
Time works yes
Zone works no
Locale.getAvailableLocales() 780 (base + CLDR)
DecimalStyle.getAvailableLocales() 397 (supported by browser Intl implementation)
DateTimeFormatStyleProvider.getAvailableLocales() 406 (supported by browser Intl implementation)
In the demo application, it takes 10Kb more - 215kB (1.3MB uncompressed)

Set with TZDB

To use all java.util.time classes, you need to add the following dependency:

<dependency>
	<groupId>org.jresearch.gwt.time</groupId>
	<artifactId>org.jresearch.gwt.time</artifactId>
</dependency>
<dependency>
	<groupId>org.jresearch.gwt.time</groupId>
	<artifactId>org.jresearch.gwt.time.tzdb</artifactId>
</dependency>

It will enable all java.util.time classes and base locales (18 locales) from java.util.Locale class. See demo.time03 module for the complete example.

Action Result
Time works yes
Zone works yes
Locale.getAvailableLocales() 19 (base + CLDR)
DecimalStyle.getAvailableLocales() 18 (supported by browser Intl implementation)
DateTimeFormatStyleProvider.getAvailableLocales() 18 (supported by browser Intl implementation)
In the demo application, it takes 92Kb more - 297kB (1.6MB uncompressed)

Full set with CLDR locations and TZDB

To use all java.util.time classes and all CLDR location, you need to add the following dependency:

<dependency>
	<groupId>org.jresearch.gwt.locale</groupId>
	<artifactId>org.jresearch.gwt.locale.cldr</artifactId>
</dependency>
<dependency>
	<groupId>org.jresearch.gwt.time</groupId>
	<artifactId>org.jresearch.gwt.time</artifactId>
</dependency>
<dependency>
	<groupId>org.jresearch.gwt.time</groupId>
	<artifactId>org.jresearch.gwt.time.tzdb</artifactId>
</dependency>

It will enable all java.util.time classes including java.time.ZonedDateTime, base locales (18 locales) from java.util.Locale class, plus all CLDR locales. See demo.time04 module for the complete example.

Action Result
Time works yes
Zone works yes
Locale.getAvailableLocales() 780 (base + CLDR)
DecimalStyle.getAvailableLocales() 397 (supported by browser Intl implementation)
DateTimeFormatStyleProvider.getAvailableLocales() 406 (supported by browser Intl implementation)
In the demo application, it takes 102Kb more - 307kB (1.6MB uncompressed)