From 6326f03a3b4427f9f87cb36da60959c440261b79 Mon Sep 17 00:00:00 2001 From: Wooyoung Myung Date: Wed, 28 Feb 2024 21:54:16 +0900 Subject: [PATCH] =?UTF-8?q?kuring-136=20[=EC=88=98=EC=A0=95]=20=EB=B0=94?= =?UTF-8?q?=EB=80=90=20=ED=95=99=EA=B3=BC=EB=B3=84=20=EA=B3=B5=EC=A7=80=20?= =?UTF-8?q?=EB=82=A0=EC=A7=9C=20=ED=8F=AC=EB=A7=B7=20=EB=8C=80=EC=9D=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ku_ring/notice/mapper/ResponseToEntity.kt | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/data/notice/src/main/java/com/ku_stacks/ku_ring/notice/mapper/ResponseToEntity.kt b/data/notice/src/main/java/com/ku_stacks/ku_ring/notice/mapper/ResponseToEntity.kt index fe4169903..c91609786 100644 --- a/data/notice/src/main/java/com/ku_stacks/ku_ring/notice/mapper/ResponseToEntity.kt +++ b/data/notice/src/main/java/com/ku_stacks/ku_ring/notice/mapper/ResponseToEntity.kt @@ -2,8 +2,6 @@ package com.ku_stacks.ku_ring.notice.mapper import com.ku_stacks.ku_ring.local.entity.NoticeEntity import com.ku_stacks.ku_ring.remote.notice.response.DepartmentNoticeResponse -import java.text.SimpleDateFormat -import java.util.Locale fun List.toEntityList(shortName: String, startDate: String) = @@ -14,24 +12,16 @@ fun List.toEntityList(shortName: String, startDate: St * TODO: NPE 대신 빈 문자열을 넣도록 수정 */ fun DepartmentNoticeResponse.toNoticeEntity(shortName: String, startDate: String): NoticeEntity { - val dashRemovedPostedDate = removeDashFromDate(postedDate!!) return NoticeEntity( articleId = articleId!!, category = category!!, department = shortName, subject = subject!!, - postedDate = dashRemovedPostedDate, + postedDate = postedDate!!, url = url!!, - isNew = (dashRemovedPostedDate >= startDate), + isNew = (postedDate!! >= startDate), isRead = false, isSaved = false, isReadOnStorage = false, ) -} - -private fun removeDashFromDate(dashSeparatedDate: String): String { - val inputFormatter = SimpleDateFormat("yyyy-MM-dd", Locale.getDefault()) - val outputFormatter = SimpleDateFormat("yyyyMMdd", Locale.getDefault()) - val date = inputFormatter.parse(dashSeparatedDate) - return outputFormatter.format(date) } \ No newline at end of file