0,1歳日誌データ連携

This commit is contained in:
2025-02-13 16:43:24 +08:00
parent fe23e8e8b3
commit 41a6388d73
4 changed files with 197 additions and 27 deletions

View File

@@ -136,7 +136,7 @@ function createBtnGroupArea(groupId, btnLabel, btnOnClick, { btnElId = false, ye
function checkInputData(map, { btnLabel, yearElId, monthElId, dateElId, classElId }) {
const year = yearElId && map[yearElId].value;
const month = monthElId && map[monthElId].value;
const date = dateElId && (map[dateElId].value === 'end' ? getLastDate(year, month) : map[dateElId].value);
const date = dateElId && (map[dateElId].value === 'end' ? getLastDate(year, month).getDate() : map[dateElId].value);
const className = classElId && map[classElId].value;
const errorMsgs = [];
@@ -170,7 +170,7 @@ function checkInputData(map, { btnLabel, yearElId, monthElId, dateElId, classElI
}
function getLastDate(year, month) {
return new Date(year, month, 0).getDate();
return new Date(year, month, 0);
}
function createBtn(id, label, onClick) {
@@ -239,9 +239,9 @@ function getFormatDateString(dateObjOrYear, month, date) {
}
const formatY = year;
const formatM = String(month).padStart(2, '0');
const formatD = date ? String(date).padStart(2, '0') : '';
const formatD = String(date).padStart(2, '0');
return formatY + '-' + formatM + (formatD && ('-' + formatD));
return `${formatY}-${formatM}-${formatD}`;
}
function loading(show, text) {