Skip to content

Commit

Permalink
fix: 날짜 입력 필드에 빈칸이 들어갈 수 있도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
yechan-kim committed Aug 31, 2024
1 parent 2764ca5 commit 1c80727
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/resources/static/main.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<form id="uploadForm" enctype="multipart/form-data">
<input type="file" name="file"/>
<label>
<input type="text" id="dateInput" name="date" placeholder="날짜입력(YYYY-MM-DD)"/>
<input type="text" id="dateInput" name="date" placeholder="날짜(YYYY-MM-DD)를 입력하지 않으면 최근 조회 가능한 날짜가 자동으로 설정"/>
</label>
<button id="upload" type="submit">DB에 업로드</button>
</form>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/static/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ document.addEventListener("DOMContentLoaded", function () {

// 날짜 형식 검사 (YYYY-MM-DD)
const datePattern = /^\d{4}-\d{2}-\d{2}$/;
if (!dateInput.match(datePattern)) {
if (dateInput !== "" && !dateInput.match(datePattern)) {
alert("날짜 형식이 올바르지 않습니다.");
return;
}
Expand Down

0 comments on commit 1c80727

Please sign in to comment.