Skip to content
Browse files

Add ZonedDateTime creation to DateTimeBuilder

  • Loading branch information...
1 parent b78bd4f commit b4efc15e944f52106fc3d35fb9e5064e3e7ad24d @graben graben committed May 1, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/main/java/javax/time/calendrical/DateTimeBuilder.java
View
8 src/main/java/javax/time/calendrical/DateTimeBuilder.java
@@ -49,6 +49,7 @@
import javax.time.OffsetTime;
import javax.time.ZoneId;
import javax.time.ZoneOffset;
+import javax.time.ZonedDateTime;
/**
* Builder that can combine date and time fields into date and time objects.
@@ -569,7 +570,9 @@ private void mergeObjects() {
LocalDate ld = (LocalDate) objects.get(LocalDate.class);
LocalTime lt = (LocalTime) objects.get(LocalTime.class);
ZoneOffset offset = (ZoneOffset) objects.get(ZoneOffset.class);
+ ZoneId id = (ZoneId) objects.get(ZoneId.class);
LocalDateTime ldt = null;
+ OffsetDateTime odt = null;
if (ld != null && lt != null) {
ldt = LocalDateTime.of(ld, lt);
addCalendrical(ldt);
@@ -581,10 +584,13 @@ private void mergeObjects() {
addCalendrical(OffsetDate.of(ld, offset));
}
if (ldt != null && offset != null) {
- OffsetDateTime odt = OffsetDateTime.of(ldt, offset);
+ odt = OffsetDateTime.of(ldt, offset);
addCalendrical(odt);
addCalendrical(odt.toInstant());
}
+ if (odt != null && id != null) {
+ addCalendrical(ZonedDateTime.of(odt, id));
+ }
}
//-----------------------------------------------------------------------

0 comments on commit b4efc15

Please sign in to comment.
Something went wrong with that request. Please try again.