metrics.adjustDates(adj);
adjustPeriodNoteTimestamps(adj);
}
protected DateAdjuster normalizeDates(int offset) {
RangeDateAdjuster result = new RangeDateAdjuster();
Calendar c = Calendar.getInstance();
for (Iterator i = periods.iterator(); i.hasNext();) {
Period p = (Period) i.next();
Date origDate = p.endDate;
c.setTime(origDate);
// add the offset. This should get us "close to" midnight in the
// target time zone.
c.add(Calendar.MILLISECOND, offset);
// now add four hours, and then truncate the date. This will
// account for differences due to daylight savings time.
c.add(Calendar.HOUR_OF_DAY, 4);
c.set(Calendar.HOUR_OF_DAY, 0);
c.set(Calendar.MINUTE, 0);
c.set(Calendar.SECOND, 0);
c.set(Calendar.MILLISECOND, 0);
Date newDate = c.getTime();
p.endDate = newDate;
p.note = NOTE_NEEDS_CALC;
result.add(origDate, newDate);
}
// we are returning a DateAdjuster that alters timestamps for various
// calendar periods. But the special date "NEVER" should not be
// altered, so we add a specific statement not to alter that timestamp.
result.add(EVSchedule.NEVER, 0);
effectiveDate = result.adjust(effectiveDate);
metrics.adjustDates(result);
adjustPeriodNoteTimestamps(result);
return result;
}