-
Notifications
You must be signed in to change notification settings - Fork 9
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
base: develop
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
한번 리뷰 확인해주세요
"${startAtDateTime.monthNumber}월 ${startAtDateTime.dayOfMonth}일 " + | ||
"${timeFormat.format(startAtDateTime)} - " + | ||
timeFormat.format(endAtDateTime) |
There was a problem hiding this comment.
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 FORMAT_PATTERN = "HH:mm" | ||
|
||
@OptIn(FormatStringsInDatetimeFormats::class) | ||
val timeFormat = LocalDateTime.Format { | ||
byUnicodePattern(FORMAT_PATTERN) | ||
} | ||
} |
There was a problem hiding this comment.
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"로 파싱하고 싶다면?) 어떻게 해야할까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@l2hyunwoo ㅖ? 저요?
There was a problem hiding this comment.
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을 반환한다면 괜찮을까요??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@t1nm1ksun getTimeFormat 함수를 TimeFormat 오브젝트에 담아두는 이유가 있을까요? 의견이 궁금합니다.
There was a problem hiding this comment.
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) | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 기능이 attendance에만 사용될 기능이 아닐 것 같아서 웬만하면 core common 모듈 쪽으로 빼두는 걸 추천드릴게요.
"${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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 블로그 활용해서 이 부분 코드 어떻게 고칠 수 있을 지 한번 고민해보시면 좋을 것 같아요! 그러면 timeFormat 함수쪽 설계도 조금 달라져야겠죠?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
시험만 끝나고 얼른 해보겠습니다..!!
늦어져서 죄송합니다 ㅜㅜ
5ec08fd
to
f073a3e
Compare
What is this issue?
Reference
Etc
기존 UI와 똑같이 뜬다면 잘 변경한 걸까요..?