날짜수정 잘 들어감

This commit is contained in:
leeheejin
2025-11-13 13:56:10 +09:00
parent 56aa05513c
commit b567dedcaa

View File

@@ -389,8 +389,38 @@ $(document).ready(function(){
var today = new Date();
var days = ['일', '월', '화', '수', '목', '금', '토'];
var dateStr = days[today.getDay()] + "요일, " + (today.getMonth() + 1) + "월 " + today.getDate() + ", " + today.getFullYear();
// 표시용 날짜 (한글)
$("#deliveryDate").text(dateStr);
// 전송용 날짜 (YYYY-MM-DD) - hidden input에 저장
var year = today.getFullYear();
var month = String(today.getMonth() + 1).padStart(2, '0');
var day = String(today.getDate()).padStart(2, '0');
var isoDate = year + "-" + month + "-" + day;
$("#deliveryDateISO").val(isoDate);
fn_loadData();
// 날짜 수정 시 ISO 형식도 업데이트
$("#deliveryDate").on('blur', function() {
var dateText = $(this).text().trim();
// 날짜 파싱 시도
try {
// "목요일, 11월 15, 2025" 형식 파싱
var match = dateText.match(/(\d+)월\s*(\d+),?\s*(\d{4})/);
if (match) {
var year = match[3];
var month = String(match[1]).padStart(2, '0');
var day = String(match[2]).padStart(2, '0');
var isoDate = year + "-" + month + "-" + day;
$("#deliveryDateISO").val(isoDate);
console.log("날짜 업데이트: " + dateText + " → " + isoDate);
}
} catch(e) {
console.error("날짜 파싱 실패:", e);
}
});
});
function fn_loadData() {
@@ -555,7 +585,7 @@ function fn_save() {
// 수정된 데이터 수집
var data = {
projectNos: "${param.projectNos}",
deliveryDate: $("#deliveryDate").text(),
deliveryDate: $("#deliveryDateISO").val(),
receiverName: $("#receiverName").text(),
registrationNo: $("#registrationNo").text(),
supplierName: $("#supplierName").text(),
@@ -629,6 +659,7 @@ function fn_close() {
<td class="date-label-cell">납품일</td>
<td class="date-value-cell" colspan="4">
<span id="deliveryDate" contenteditable="true">수요일, 9월 24, 2025</span>
<input type="hidden" id="deliveryDateISO" value="">
</td>
<td class="supplier-label-cell" rowspan="5">
<div style="display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%;">