When setting time zone, BaseDateTimeDt should return an instance of itself. Otherwise, it is difficult to work with.

This commit is contained in:
miantorno 2015-08-24 15:55:02 -04:00
parent df4d371edc
commit 230b9d4922
1 changed files with 6 additions and 3 deletions

View File

@ -386,7 +386,7 @@ public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
updateStringValue(); updateStringValue();
} }
private void setTimeZone(String theValueString, boolean hasMillis) { private BaseDateTimeDt setTimeZone(String theValueString, boolean hasMillis) {
clearTimeZone(); clearTimeZone();
int timeZoneStart = 19; int timeZoneStart = 19;
if (hasMillis) if (hasMillis)
@ -398,16 +398,19 @@ public abstract class BaseDateTimeDt extends BasePrimitive<Date> {
} else if (theValueString.indexOf('+', timeZoneStart) != -1 || theValueString.indexOf('-', timeZoneStart) != -1) { } else if (theValueString.indexOf('+', timeZoneStart) != -1 || theValueString.indexOf('-', timeZoneStart) != -1) {
setTimeZone(TimeZone.getTimeZone("GMT" + theValueString.substring(timeZoneStart))); setTimeZone(TimeZone.getTimeZone("GMT" + theValueString.substring(timeZoneStart)));
} }
return this;
} }
public void setTimeZone(TimeZone theTimeZone) { public BaseDateTimeDt setTimeZone(TimeZone theTimeZone) {
myTimeZone = theTimeZone; myTimeZone = theTimeZone;
updateStringValue(); updateStringValue();
return this;
} }
public void setTimeZoneZulu(boolean theTimeZoneZulu) { public BaseDateTimeDt setTimeZoneZulu(boolean theTimeZoneZulu) {
myTimeZoneZulu = theTimeZoneZulu; myTimeZoneZulu = theTimeZoneZulu;
updateStringValue(); updateStringValue();
return this;
} }
/** /**