// -1 (in past), 1d, 4d, 1w, 2w, 1m, 2m, -
private String getUpfrontReservationTime(Long dateInMillis) {
DateTime now = new DateTime(DateTimeZone.forTimeZone(TimeZone.getTimeZone("UTC")));
DateTime event = new DateTime(dateInMillis, DateTimeZone.forTimeZone(TimeZone.getTimeZone("UTC")));
Duration duration = new Duration(now, event);
if (duration.getMillis() < 0) {
return "-1";
} else if (duration.getStandardSeconds() < 86400) {
return "1d";
} else if (duration.getStandardDays() < 4) {
return "4d";
} else if (duration.getStandardDays() < 7) {
return "1w";
} else if (duration.getStandardDays() < 14) {
return "2w";
} else if (duration.getStandardDays() < 28) {
return "4w";
} else if (duration.getStandardDays() < 56) {
return "8w";
} else {
return "-";
}
}