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:
committed by
GitHub
parent
2e9e100178
commit
675e5f6fe8
@@ -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 : ''}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user