Skip to content

Commit

Permalink
feat: 내 페이지 그룹 가입 일자 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
CChuYong committed Jan 28, 2024
1 parent 2cb65a9 commit 8c3b522
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ data class Member(
val imageUrl: String?,
val familyId: String?,
val dayOfBirth: String,
val familyJoinAt: String?,
) : Parcelable, BaseModel() {
@IgnoredOnParcel
val isBirthdayToday: Boolean = LocalDate
Expand All @@ -36,7 +37,8 @@ data class Member(
_name = "DeletedMember",
imageUrl = null,
familyId = null,
dayOfBirth = "2001-12-30"
dayOfBirth = "2001-12-30",
familyJoinAt = null,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import com.no5ing.bbibbi.data.model.APIResponse
import com.no5ing.bbibbi.data.model.member.Member
import com.no5ing.bbibbi.presentation.component.CircleProfileImage
import com.no5ing.bbibbi.presentation.theme.bbibbiScheme
import com.no5ing.bbibbi.presentation.theme.bbibbiTypo
import com.no5ing.bbibbi.util.toLocalizedDate

@Composable
fun ProfilePageMemberBar(
Expand Down Expand Up @@ -105,9 +107,17 @@ fun ProfilePageMemberBar(
)
}
}
Spacer(modifier = Modifier.height(20.dp))
if (viewerMemberId == memberState.value.data.memberId) {
Spacer(modifier = Modifier.height(12.dp))
Text(
text = "${toLocalizedDate(memberState.value.data.familyJoinAt ?: "2000-01-01")} 가입",
style = MaterialTheme.bbibbiTypo.caption,
color = MaterialTheme.bbibbiScheme.icon,
)
}
Spacer(modifier = Modifier.height(24.dp))
Divider(thickness = 1.dp, color = MaterialTheme.bbibbiScheme.backgroundSecondary)
Spacer(modifier = Modifier.height(20.dp))
Spacer(modifier = Modifier.height(24 .dp))
}
}
}
7 changes: 7 additions & 0 deletions app/src/main/java/com/no5ing/bbibbi/util/DateParser.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ fun toLocalizedDate(time: ZonedDateTime): String {
return yearDateFormatter.format(time)
}

fun toLocalizedDate(date: String): String {
val localDate = LocalDate.parse(date)
if (localDate.year == ZonedDateTime.now().year)
return dateFormatter.format(localDate)
return yearDateFormatter.format(localDate)
}

fun todayAsString() = LocalDate.now().toString()

fun getZonedDateTimeString() = ZonedDateTime.now().toString()
Expand Down

0 comments on commit 8c3b522

Please sign in to comment.