Skip to content

Commit

Permalink
[feat] #129 date 자료형 string으로 변환
Browse files Browse the repository at this point in the history
  • Loading branch information
nagaeng committed Oct 11, 2024
1 parent c0cf5d0 commit 48315b5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import com.record.ui.base.UiState
import com.record.video.model.VideoData
import kotlinx.collections.immutable.ImmutableList
import kotlinx.collections.immutable.toImmutableList
import java.util.Date

data class DetailpageState(
val placeName: String = "국립현대미술관",
Expand All @@ -16,7 +15,7 @@ data class DetailpageState(
val reviewCursor: Long = 0,
val reviewIsEnd: Boolean = false,
val detailpageTab: DetailpageTab = DetailpageTab.LIST,
val exhibitionList: ImmutableList<Triple<String, Date, Date>> = emptyList<Triple<String, Date, Date>>().toImmutableList(),
val exhibitionList: ImmutableList<Triple<String, String, String>> = emptyList<Triple<String, String, String>>().toImmutableList(),
val reviewList: ImmutableList<VideoData> = emptyList<VideoData>().toImmutableList(),
) : UiState

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,10 @@ import androidx.compose.ui.unit.dp
import com.record.designsystem.R
import com.record.designsystem.theme.RecordyTheme
import kotlinx.collections.immutable.ImmutableList
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale

@Composable
fun ListScreen(
exhibitionItems: ImmutableList<Triple<String, Date, Date>>,
exhibitionItems: ImmutableList<Triple<String, String, String>>,
exhibitionCount: Int,
selectedChip: ChipTab,
onChipSelected: (ChipTab) -> Unit,
Expand Down Expand Up @@ -103,7 +100,7 @@ fun ListScreen(
}

@Composable
fun ExhibitionItem(name: String, startDate: Date, endDate: Date, onButtonClick: () -> Unit) {
fun ExhibitionItem(name: String, startDate: String, endDate: String, onButtonClick: () -> Unit) {
Box(
modifier = Modifier
.fillMaxWidth()
Expand Down Expand Up @@ -144,9 +141,10 @@ fun ExhibitionItem(name: String, startDate: Date, endDate: Date, onButtonClick:
}
}

fun formatDate(startDate: Date, endDate: Date): String {
val dateFormat = SimpleDateFormat("yyyy년 MM월 dd일", Locale.getDefault())
return "${dateFormat.format(startDate)}~${dateFormat.format(endDate)}"
fun formatDate(startDate: String, endDate: String): String {
val startFormatted = "${startDate.substring(0, 4)}${startDate.substring(4, 6)}${startDate.substring(6, 8)}"
val endFormatted = "${endDate.substring(0, 4)}${endDate.substring(4, 6)}${endDate.substring(6, 8)}"
return "$startFormatted~$endFormatted"
}

@Composable
Expand Down

0 comments on commit 48315b5

Please sign in to comment.