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

날짜 포맷 변경으로 인한 DateFormatter 코드 리팩토링 #235

Merged
merged 10 commits into from
Mar 31, 2023

Conversation

DSMInhyeKang
Copy link
Member

개요

  • 서버의 모든 날짜 포맷이 변경되었습니다. 따라서 현재 시간으로 초기화되는 오류를 고치기 위해 DateFormatter 코드를 리팩토링합니다.

작업사항

  • 자습실/잔류 신청 시간, 공지 목록 날짜, 공지 상세조회 날짜, 워치 공지 날짜의 DateFormatter 코드를 리팩토링했습니다.

@DSMInhyeKang DSMInhyeKang added the ♻️refactor 코드 리팩토링 할 경우 label Mar 27, 2023
@DSMInhyeKang DSMInhyeKang self-assigned this Mar 27, 2023
@DSMInhyeKang DSMInhyeKang requested a review from a team as a code owner March 27, 2023 14:26
Comment on lines 34 to 38
let param = (iso8601Formatter.date(from: self) ?? .init()).toDMSNoticeTimeString()

let formatter = DateFormatter()
formatter.dateFormat = "yy/MM/dd HH:mm"
return formatter.date(from: param) ?? .init()
Copy link
Member

Choose a reason for hiding this comment

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

이 과정에 왜필요한거죠?

Copy link
Member Author

Choose a reason for hiding this comment

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

서버에서 데이터가 date 형식으로 오는데 date로 반환되어야 원래 사용하던 곳에서 사용 가능해서 string으로 바꾸고 한 번 더 포매팅을 해줬어요,,,,

Copy link
Member

Choose a reason for hiding this comment

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

그걸 iso8601formatter가 하는거 아닌가요..?

Copy link
Member Author

Choose a reason for hiding this comment

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

아 string으로 오는데 iso로 date로 바꾸고 string으로 변환한담에,,, 다시 포맷 맞춰서 date로 반환하게 짰어요... 그냥 저 dateFormat에 바로 넣으면 자꾸 현재 날짜/시간으로 초기화가 돼서,,,

이렇게 하면 시간 날짜 다 정상으로 나오긴 해요,,,, 좀 많이 하드코딩일 뿐,,,,,,,,
뻘짓을 신나게 하고 있었네요,,,
Copy link
Member Author

Choose a reason for hiding this comment

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

@baekteun 얘네도 뺄까요? 워치가 시뮬에선 작동 안 해서 확인을 못했어요

Copy link
Member

Choose a reason for hiding this comment

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

어..

Copy link
Member

Choose a reason for hiding this comment

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

iOS에서 변경된대로 따라가죠

Copy link
Member

Choose a reason for hiding this comment

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

똑같은 API라 iOS가 되면 둘 다 될거같은데,, 뭐 하늘에 빌어아죠

Copy link
Member Author

Choose a reason for hiding this comment

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

음.,, 워치는 지금 날짜 사이에 -로 구분하는데 iOS 앱 처럼 /로 구분하게 맞출까요?

Copy link
Member

Choose a reason for hiding this comment

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

아 파싱하는거 말고 화면에 보일때 말한거였나요?

Copy link
Member Author

Choose a reason for hiding this comment

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

스크린샷 2023-03-30 오후 11 09 54

스크린샷 2023-03-30 오후 11 10 24

넹 요고

Copy link
Member

Choose a reason for hiding this comment

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

엄ㅁ.. 그냥 이대로 갈까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

@DSMInhyeKang DSMInhyeKang merged commit 4ee66a5 into develop Mar 31, 2023
@DSMInhyeKang DSMInhyeKang deleted the 234-refactor-dateformatter-code branch March 31, 2023 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
♻️refactor 코드 리팩토링 할 경우
Projects
None yet
Development

Successfully merging this pull request may close these issues.

날짜 포맷 변경으로 인한 DateFormatter 코드 리팩토링
2 participants