-
Notifications
You must be signed in to change notification settings - Fork 10
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
[1주차] 오대균 미션 제출합니다. #1
base: master
Are you sure you want to change the base?
Changes from 1 commit
973977e
1d64edf
dd15cd2
8af7471
b292514
3661d25
a41189c
7f149f5
04c806f
be1b69b
ff43d6e
d0b7045
76e5d66
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,11 @@ addBtn.addEventListener('click', handleClickAddBtn); | |
const utc = Date.now(); | ||
const timeOff = new Date().getTimezoneOffset() * 60000; | ||
const today = new Date(utc - timeOff).toISOString().split('T')[0]; | ||
document.querySelector('.dateInput').setAttribute('min', today); | ||
const dateInputs = document | ||
.querySelectorAll('.dateInput') | ||
.forEach((dateInput) => { | ||
dateInput.setAttribute('min', today); | ||
}); | ||
|
||
// 시작일 설정에 change event handler 등록 | ||
const fromDate = document.querySelector('.from'); | ||
|
@@ -153,7 +157,7 @@ function handleClickAddBtn() { | |
const fromDate = document.querySelector('.from'); | ||
const toDate = document.querySelector('.to'); | ||
|
||
if (!content.value || !fromDate.value || !toDate.value) return; | ||
if (!content.value) return; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 이 부분은 저도 리뷰를 받아서 알게 된 부분인데, input 입력시 스페이스바를 눌렀을때도 리스트에 추가되는데, trim()을 통해 공백을 제거하시면 빈 스페이스바 todo 를 방지할수 있다고 합니다! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 아 그렇네요!! 고려하지 못한 디테일이었는데 덕분에 알게되었습니다 감사합니다~~ |
||
newTodo.idx = nextIdx++; | ||
newTodo.content = content.value; | ||
priorities.forEach((priority) => { | ||
|
@@ -162,8 +166,8 @@ function handleClickAddBtn() { | |
return; | ||
} | ||
}); | ||
newTodo.fromDate = new Date(fromDate.value); | ||
newTodo.toDate = new Date(toDate.value); | ||
newTodo.fromDate = fromDate.value ? new Date(fromDate.value) : new Date(); | ||
newTodo.toDate = toDate.value ? new Date(toDate.value) : new Date(); | ||
Comment on lines
+182
to
+183
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 삼항 연산자를 통해 날짜를 등록하지 않았을 떄의 예외처리 까지 하신 것이 인상깊네요! |
||
newTodo.isDone = false; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isDone으로 todo랑 done 구분하는 방법도 직관적이고 좋은 것 같네요~! |
||
|
||
pushTodo(newTodo); | ||
|
@@ -183,5 +187,6 @@ function handleChangeFromDate(e) { | |
let timeOff = new Date().getTimezoneOffset() * 60000; | ||
let today = new Date(utc - timeOff).toISOString().split('T')[0]; | ||
document.querySelector('.to').setAttribute('min', today); | ||
document.querySelector('.to').setAttribute('value', e.currentTarget.value); | ||
} | ||
} |
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.
시작일 설정에 대한 제한도 걸어두신거 좋은 아이디어 인것 같아요! foreach 함수를 자유롭게 사용하시는 것 같아요 저도 배워야겠어요!