Skip to content

Commit

Permalink
feature #7 : fix datetime type
Browse files Browse the repository at this point in the history
  • Loading branch information
tunaunnie committed Nov 21, 2024
1 parent 451e48f commit 964d412
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
import org.sopt.cgv.core.common.norippleclick
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter


@Composable
fun CompTimeCard(
modifier: Modifier = Modifier,
startTime: String,
endTime: String,
startTime: LocalDateTime,
endTime: LocalDateTime,
currentSeats: Int,
totalSeats: Int,
isMorning: Boolean
Expand All @@ -49,6 +51,10 @@ fun CompTimeCard(
val backgroundColor2 = if (isClicked) Gray700 else Gray200
val leftSeatsColor = if (isClickedCard) PrimaryRed400 else Green

val timeFormatter = DateTimeFormatter.ofPattern("HH:mm")
val formattedStartTime = startTime.format(timeFormatter)
val formattedEndTime = endTime.format(timeFormatter)

Box(
modifier = Modifier
.size(width = 90.dp, height = 64.dp)
Expand All @@ -72,13 +78,13 @@ fun CompTimeCard(
horizontalArrangement = Arrangement.Center,
){
Text(
text = startTime,
text = formattedStartTime,
color = Black,
style = Typography.head1_b_16
)
Text(
modifier = Modifier.padding(top = 4.dp),
text = "~$endTime",
text = "~$formattedEndTime",
color = Gray600,
style = Typography.body0_r_8
)
Expand Down Expand Up @@ -133,8 +139,8 @@ fun CompTimeCard(
fun CompTimeCardPreview() {
CompTimeCard(
modifier = Modifier,
startTime = "07:50",
endTime = "09:41",
startTime = LocalDateTime.of(2024, 11, 19, 7, 50),
endTime = LocalDateTime.of(2024, 11, 19, 9, 41),
currentSeats = 183,
totalSeats = 185,
isMorning = true
Expand Down

0 comments on commit 964d412

Please sign in to comment.