add: car date handline
This commit is contained in:
@@ -88,6 +88,31 @@ export function fromRFC3339(dateString) {
|
||||
return date.toISOString().split('T')[0];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {App.Types['car']} car - The car object to format
|
||||
*/
|
||||
export function carDatesFromRFC3339(car) {
|
||||
car.end_date = fromRFC3339(car.end_date);
|
||||
car.start_date = fromRFC3339(car.start_date);
|
||||
car.insurances?.forEach((insurance) => {
|
||||
insurance.start_date = fromRFC3339(insurance.start_date);
|
||||
insurance.end_date = fromRFC3339(insurance.end_date);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {App.Types['car']} car - The car object to format
|
||||
*/
|
||||
export function carDatesToRFC3339(car) {
|
||||
car.end_date = toRFC3339(car.end_date);
|
||||
car.start_date = toRFC3339(car.start_date);
|
||||
car.insurances?.forEach((insurance) => {
|
||||
insurance.start_date = toRFC3339(insurance.start_date);
|
||||
insurance.end_date = toRFC3339(insurance.end_date);
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param {App.Locals['user']} user - The user object to format
|
||||
|
||||
Reference in New Issue
Block a user