Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[refactor/#708] attendance Time Format 방식 수정 #925

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

t1nm1ksun
Copy link

@t1nm1ksun t1nm1ksun commented Oct 18, 2024

What is this issue?

  • 새로 추가된 포매터를 활용해서 kotlinx.datetime 형식의 포맷 방식을 수정합니다.

Reference

  • 수정 전 UI
description
  • 수정 후 UI
description

Etc

기존 UI와 똑같이 뜬다면 잘 변경한 걸까요..?

@t1nm1ksun t1nm1ksun requested a review from a team as a code owner October 18, 2024 08:30
Copy link

height bot commented Oct 18, 2024

Link Height tasks by mentioning a task ID in the pull request title or commit messages, or description and comments with the keyword link (e.g. "Link T-123").

💡Tip: You can also use "Close T-X" to automatically close a task when the pull request is merged.

Copy link
Member

@l2hyunwoo l2hyunwoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

한번 리뷰 확인해주세요

Comment on lines 89 to 91
"${startAtDateTime.monthNumber}월 ${startAtDateTime.dayOfMonth}일 " +
"${timeFormat.format(startAtDateTime)} - " +
timeFormat.format(endAtDateTime)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

지금 문자열 리터럴 쓴 부분도 유니코드 패턴으로 사용해서 문자열 포맷팅 할 수 있지 않을까요?

Comment on lines 116 to 124
object TimeFormat{
private const val FORMAT_PATTERN = "HH:mm"

@OptIn(FormatStringsInDatetimeFormats::class)
val timeFormat = LocalDateTime.Format {
byUnicodePattern(FORMAT_PATTERN)
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재는 HH:mm 형태만 파싱을 하고 있는데 다른 개발자 분들이 다른 형태로 파싱을 하고 싶은 경우에는 (예를들어 세훈님은 "YYYY.MM.dd" 형태로, 저는 "HH:mm:SS"로 파싱하고 싶다면?) 어떻게 해야할까요?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@l2hyunwoo ㅖ? 저요?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

object TimeFormat {
    private const val DEFAULT_FORMAT_PATTERN = "HH:mm"

    @OptIn(FormatStringsInDatetimeFormats::class)
    fun getTimeFormat(pattern: String = DEFAULT_FORMAT_PATTERN): DateTimeFormat<LocalDateTime> {
        return LocalDateTime.Format {
            byUnicodePattern(pattern)
        }
    }
}

현재 쓰는 "HH:mm" 패턴을 디폴트값으로 주고 추가적으로 다른 패턴을 사용하고 싶다면 이런식으로 패턴을 인자로 받아서 Format을 반환한다면 괜찮을까요??

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@t1nm1ksun getTimeFormat 함수를 TimeFormat 오브젝트에 담아두는 이유가 있을까요? 의견이 궁금합니다.

Copy link
Member

@l2hyunwoo l2hyunwoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다시 한번 고민해주시면 감사하겠습니다 🙇🏻

Comment on lines +115 to +124
object TimeFormat {
private const val DEFAULT_FORMAT_PATTERN = "HH:mm"

@OptIn(FormatStringsInDatetimeFormats::class)
fun getTimeFormat(pattern: String = DEFAULT_FORMAT_PATTERN): DateTimeFormat<LocalDateTime> {
return LocalDateTime.Format {
byUnicodePattern(pattern)
}
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 기능이 attendance에만 사용될 기능이 아닐 것 같아서 웬만하면 core common 모듈 쪽으로 빼두는 걸 추천드릴게요.

Comment on lines -81 to +96
"${startAtDateTime.monthNumber}월 ${startAtDateTime.dayOfMonth}일 ${
startAtDateTime.hour.toString().padStart(2, '0')
}:${startAtDateTime.minute.toString().padStart(2, '0')} - ${
endAtDateTime.hour.toString().padStart(2, '0')
}:${endAtDateTime.minute.toString().padStart(2, '0')}"
"${startAtDateTime.monthNumber}\uC6D4 ${startAtDateTime.dayOfMonth}\uC77C " +
"${getTimeFormat().format(startAtDateTime)} - " +
getTimeFormat().format(endAtDateTime)
} else {
"${startAtDateTime.monthNumber}월 ${startAtDateTime.dayOfMonth}일 ${
startAtDateTime.hour.toString().padStart(2, '0')
}:${
startAtDateTime.minute.toString().padStart(2, '0')
} - ${endAtDateTime.monthNumber}월 ${endAtDateTime.dayOfMonth}일 ${
endAtDateTime.hour.toString().padStart(2, '0')
}:${endAtDateTime.minute.toString().padStart(2, '0')}"
"${startAtDateTime.monthNumber}\uC6D4 ${startAtDateTime.dayOfMonth}\uC77C " +
"${getTimeFormat().format(startAtDateTime)} - " +
"${endAtDateTime.monthNumber}\uC6D4 ${endAtDateTime.dayOfMonth}\uC77C " +
getTimeFormat().format(endAtDateTime)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 블로그 활용해서 이 부분 코드 어떻게 고칠 수 있을 지 한번 고민해보시면 좋을 것 같아요! 그러면 timeFormat 함수쪽 설계도 조금 달라져야겠죠?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

시험만 끝나고 얼른 해보겠습니다..!!
늦어져서 죄송합니다 ㅜㅜ

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants