feat: add inspection_expiry/has_etc/tire_type fields, icons in schedule view, and WebSocket real-time sync
Co-authored-by: pdf114514 <57948770+pdf114514@users.noreply.github.com> Agent-Logs-Url: https://github.com/pdf114514/CarReservation/sessions/6d0f25ae-6db4-4937-ae2b-6674456a5ca1
This commit is contained in:
13
frontend/src/utils/carUtils.js
Normal file
13
frontend/src/utils/carUtils.js
Normal file
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* Returns true if the given inspection expiry date string is within 1 month
|
||||
* from today (or already past).
|
||||
* @param {string} inspectionExpiry - ISO date string (YYYY-MM-DD) or empty
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function isInspectionExpirySoon(inspectionExpiry) {
|
||||
if (!inspectionExpiry) return false;
|
||||
const expiry = new Date(inspectionExpiry);
|
||||
const oneMonthLater = new Date();
|
||||
oneMonthLater.setMonth(oneMonthLater.getMonth() + 1);
|
||||
return expiry <= oneMonthLater;
|
||||
}
|
||||
Reference in New Issue
Block a user