@@ -47,6 +47,7 @@ public class SwitchDateTimeDialogFragment extends DialogFragment {
4747 private Calendar dateTimeCalendar = Calendar .getInstance ();
4848 private Calendar minimumDateTime = new GregorianCalendar (1970 , 1 , 1 );
4949 private Calendar maximumDateTime = new GregorianCalendar (2200 , 1 , 1 );
50+ private TimeZone timeZone = TimeZone .getDefault ();
5051
5152 private static final String TAG_LABEL = "LABEL" ;
5253 private static final String TAG_POSITIVE_BUTTON = "POSITIVE_BUTTON" ;
@@ -132,6 +133,8 @@ public void onSaveInstanceState(Bundle savedInstanceState) {
132133 @ Override
133134 public @ NonNull Dialog onCreateDialog (Bundle savedInstanceState ) {
134135 super .onCreateDialog (savedInstanceState );
136+
137+ dateTimeCalendar .setTimeZone (timeZone );
135138
136139 if (getArguments () != null ) {
137140 mLabel = getArguments ().getString (TAG_LABEL );
@@ -563,6 +566,15 @@ public void setSimpleDateMonthAndDayFormat(SimpleDateFormat simpleDateFormat) th
563566 public void set24HoursMode (boolean is24HoursMode ) {
564567 this .is24HoursMode = is24HoursMode ;
565568 }
569+
570+ /**
571+ * Set timezone different from default
572+ */
573+ public void setTimeZone (TimeZone timeZone ) {
574+ if (timeZone != null ) {
575+ this .timeZone = timeZone ;
576+ }
577+ }
566578
567579 /**
568580 * Define if the AlertDialog must be styled, must be applied before "show"
0 commit comments