2727import java .text .DecimalFormat ;
2828import java .text .NumberFormat ;
2929import java .text .SimpleDateFormat ;
30+ import java .time .ZoneId ;
3031import java .time .format .DateTimeFormatter ;
3132import java .util .LinkedHashSet ;
3233import java .util .LinkedList ;
3536import java .util .Map .Entry ;
3637import java .util .Optional ;
3738import java .util .Set ;
39+ import java .util .TimeZone ;
3840import java .util .function .Supplier ;
3941
4042import javax .annotation .Nonnull ;
347349 * @author edgar
348350 * @since 0.1.0
349351 * @see Jooby.Module
350- * @see Request
351- * @see Response
352- * @see BodyConverter
353- * @see Router
354- * @see Filter
355352 */
356353public class Jooby {
357354
358355 /**
359- * A module can publish or produces: {@link Route.Definition routes}, {@link BodyConverter
360- * converters }, {@link Request.Module request modules} and any other
356+ * A module can publish or produces: {@link Route.Definition routes}, {@link Body.Parser},
357+ * {@link Body.Formatter }, {@link Request.Module request modules} and any other
361358 * application specific service or contract of your choice.
362359 * <p>
363360 * It is similar to {@link com.google.inject.Module} except for the callback method receives a
@@ -1361,8 +1358,10 @@ public void start() throws Exception {
13611358 String [] lang = config .getString ("application.lang" ).split ("_" );
13621359 final Locale locale = lang .length == 1 ? new Locale (lang [0 ]) : new Locale (lang [0 ], lang [1 ]);
13631360
1361+ ZoneId zoneId = ZoneId .of (config .getString ("application.tz" ));
13641362 DateTimeFormatter dateTimeFormat = DateTimeFormatter
1365- .ofPattern (config .getString ("application.dateFormat" ), locale );
1363+ .ofPattern (config .getString ("application.dateFormat" ), locale )
1364+ .withZone (zoneId );
13661365
13671366 DecimalFormat numberFormat = new DecimalFormat (config .getString ("application.numberFormat" ));
13681367
@@ -1385,6 +1384,10 @@ public void configure(final Binder binder) {
13851384 // bind locale
13861385 binder .bind (Locale .class ).toInstance (locale );
13871386
1387+ // bind time zone
1388+ binder .bind (ZoneId .class ).toInstance (zoneId );
1389+ binder .bind (TimeZone .class ).toInstance (TimeZone .getTimeZone (zoneId ));
1390+
13881391 // bind date format
13891392 binder .bind (DateTimeFormatter .class ).toInstance (dateTimeFormat );
13901393
@@ -1538,6 +1541,12 @@ private Config buildConfig(final Optional<Config> appConfig) {
15381541 config = config .withValue ("application.dateFormat" , ConfigValueFactory .fromAnyRef (pattern ));
15391542 }
15401543
1544+ // time zone
1545+ if (!config .hasPath ("application.tz" )) {
1546+ config = config .withValue ("application.tz" , ConfigValueFactory
1547+ .fromAnyRef (ZoneId .systemDefault ().getId ()));
1548+ }
1549+
15411550 // number format
15421551 if (!config .hasPath ("application.numberFormat" )) {
15431552 String pattern = ((DecimalFormat ) DecimalFormat .getInstance (locale )).toPattern ();
0 commit comments