Summary Table

Categories Total Count
PII 0
URL 0
DNS 0
EKL 0
IP 0
PORT 0
VsID 0
CF 0
AI 0
VPD 0
PL 0
Other 0

File Content

package gov.va.oneconsult.seoc.api.util;

import java.util.Calendar;
import java.util.Date;
import java.util.TimeZone;
import java.text.SimpleDateFormat;
import java.time.ZoneId;

public class TestUtil {
private static String DATE_PATTERN = "MM-dd-yyyy";
private static SimpleDateFormat formatter = new SimpleDateFormat(DATE_PATTERN);

public static final String CLIENT_KEY = "seoc-client-key";

public static Date getEffectiveDate(Date date) {
Date UTCDate = ApiUtil.getUTCZoneDateTime(date);
Date UTC5amDate = ApiUtil.getUTCCalendarDate(UTCDate);
ZoneId UTC_ZONE = ZoneId.of("UTC");

Calendar cal = Calendar.getInstance();
cal.setTime(UTC5amDate);
cal.add(Calendar.DATE, 1);
cal.setTimeZone(TimeZone.getTimeZone(UTC_ZONE));
Date calculatedDate = ApiUtil.getUTCZoneDateTime(ApiUtil.formatDateToString(cal.getTime()));

return calculatedDate;
}

public static Date getEffectiveDate() {
return getEffectiveDate(new Date());
}

public static Date getEffectiveDateFuture() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, 1);

return getEffectiveDate(cal.getTime());
}

public static Date getEffectiveDatePast() {
Calendar cal = Calendar.getInstance();
cal.add(Calendar.DATE, -2);

return getEffectiveDate(cal.getTime());
}

public static String getEffectiveDateString(Date date) {
Date calculatedDate = getEffectiveDate(date);

return formatter.format(calculatedDate);
}

public static String getEffectiveDateString() {
return getEffectiveDateString(new Date());
}

public static String getEffectiveDateStringFuture() {
return formatter.format(getEffectiveDateFuture());
}

public static String getEffectiveDateStringPast() {
return formatter.format(getEffectiveDatePast());
}
}