Skip to content

Commit 7c77324

Browse files
committed
Merge branch 'develop' of git://github.com/badlog/Android-SwitchDateTimePicker into badlog-develop
2 parents b40ae6c + f9a62d5 commit 7c77324

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

switchdatetime/src/main/java/com/kunzisoft/switchdatetime/SwitchDateTimeDialogFragment.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)