Add car reordering and AM/PM period for reservations

Agent-Logs-Url: https://github.com/pdf114514/CarReservation/sessions/c0a4b7dc-228e-4e7d-a985-61b9a17de159

Co-authored-by: pdf114514 <57948770+pdf114514@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-06 07:12:49 +00:00
committed by GitHub
parent 2e9e100178
commit 675e5f6fe8
8 changed files with 176 additions and 22 deletions

View File

@@ -11,3 +11,28 @@ export function isInspectionExpirySoon(inspectionExpiry) {
oneMonthLater.setMonth(oneMonthLater.getMonth() + 1);
return expiry <= oneMonthLater;
}
/**
* Formats a date range with optional AM/PM periods into a display string.
* @param {string} startDate - ISO date string (YYYY-MM-DD)
* @param {string} startPeriod - '午前', '午後', or ''
* @param {string} endDate - ISO date string (YYYY-MM-DD)
* @param {string} endPeriod - '午前', '午後', or ''
* @returns {string}
*/
export function formatDateRange(startDate, startPeriod, endDate, endPeriod) {
const start = startDate.slice(5) + (startPeriod ? ' ' + startPeriod : '');
const end = endDate.slice(5) + (endPeriod ? ' ' + endPeriod : '');
return `${start}${end}`;
}
/**
* Formats a reservation tooltip string with full dates and optional periods.
* @param {object} r - reservation object
* @returns {string}
*/
export function formatReservationTooltip(r) {
const start = r.start_date + (r.start_period ? ' ' + r.start_period : '');
const end = r.end_date + (r.end_period ? ' ' + r.end_period : '');
return `${r.customer_name || '予約'}\n${start}${end}${r.notes ? '\n' + r.notes : ''}`;
}