|
|
@@ -39,7 +39,7 @@ public class EventBean extends LifeplusContentsBean {
|
|
|
public static final String TYPE_SELECT_TEXT = "02";
|
|
|
public static final String TYPE_SELECT_TEXT_IMAGE = "03";
|
|
|
|
|
|
- public static final String DATE_FORMAT_SHORT = Formatter.DATE_FORMAT_DASH;
|
|
|
+ public static final String DATE_FORMAT = Formatter.DATE_FORMAT_DASH;
|
|
|
|
|
|
@SerializedName("evntType")
|
|
|
private String eventType; // 01:응모형, 02:항목선택형_글자형, 03:항목선택형_복합형
|
|
|
@@ -109,7 +109,7 @@ public class EventBean extends LifeplusContentsBean {
|
|
|
*/
|
|
|
public boolean isEventEnd() {
|
|
|
// 종료일 24시까지 비교(+24)해야 하므로 오늘 시간에서 24시간을 빼줌(-24)
|
|
|
- return isEnd(DATE_FORMAT_SHORT, getTimeTo(), System.currentTimeMillis() - Formatter.A_DAY_MILLIS);
|
|
|
+ return isEnd(DATE_FORMAT, getTimeTo(), System.currentTimeMillis() - Formatter.A_DAY_MILLIS);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -119,14 +119,39 @@ public class EventBean extends LifeplusContentsBean {
|
|
|
*/
|
|
|
public boolean isBetween() {
|
|
|
long now = System.currentTimeMillis();
|
|
|
- return isBeginning(DATE_FORMAT_SHORT, getTimeFrom(), now) && false == isEnd(DATE_FORMAT_SHORT, getTimeTo(), now);
|
|
|
+ return isBeginning(DATE_FORMAT, getTimeFrom(), now) && false == isEnd(DATE_FORMAT, getTimeTo(), now);
|
|
|
}
|
|
|
|
|
|
- public static boolean isBeginning(String format, String from, long nowMillis) {
|
|
|
+ static boolean isBeginning(String format, String from, long nowMillis) {
|
|
|
return Formatter.dateStringToMillis(format, from) <= nowMillis;
|
|
|
}
|
|
|
|
|
|
- public static boolean isEnd(String format, String to, long nowMillis) {
|
|
|
+ static boolean isEnd(String format, String to, long nowMillis) {
|
|
|
return Formatter.dateStringToMillis(format, to) < nowMillis;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 이벤트 기간 문자열
|
|
|
+ *
|
|
|
+ * @param bean EventBean
|
|
|
+ * @return "2019.03.29 ~ 2019.04.05"
|
|
|
+ */
|
|
|
+ public static String getTermString(EventBean bean) {
|
|
|
+ return new StringBuilder().append(getTimeString(bean.getTimeFrom()))
|
|
|
+ .append(" ~ ")
|
|
|
+ .append(getTimeString(bean.getTimeTo())).toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 날짜 표시 형식 변환
|
|
|
+ *
|
|
|
+ * @param timeString
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public static String getTimeString(String timeString) {
|
|
|
+ if (Formatter.validateDateFormat(EventBean.DATE_FORMAT, timeString) == false) {
|
|
|
+ return timeString;
|
|
|
+ }
|
|
|
+ return Formatter.format(timeString, EventBean.DATE_FORMAT, Formatter.DATE_FORMAT_DOT);
|
|
|
+ }
|
|
|
}
|