-
-
+
-
-
-
+
+
+
+
+
+ p.mileage !== c.mileage || p.nextservicekm !== c.nextservicekm
+ }
+ >
+ {() => {
+ const nextservicekm = form.getFieldValue("nextservicekm");
+ const mileageOver =
+ nextservicekm <= form.getFieldValue("mileage");
+
+ if (mileageOver)
+ return (
+
+
+
+ {t("contracts.labels.cardueforservice")}
+
+ {`${nextservicekm} km`}
+
+ );
+
+ return <>>;
+ }}
+
+
- p.mileage !== c.mileage ||
- p.nextservicedate !== c.nextservicedate ||
- p.nextservicekm !== c.nextservicekm
- }
+ shouldUpdate={(p, c) => p.nextservicedate !== c.nextservicedate}
>
{() => {
const nextservicedate = form.getFieldValue("nextservicedate");
- const nextservicekm = form.getFieldValue("nextservicekm");
-
- const mileageOver =
- nextservicekm <= form.getFieldValue("mileage");
-
const dueForService =
- nextservicedate && moment(nextservicedate).isBefore(moment());
+ nextservicedate &&
+ moment(nextservicedate).endOf("day").isSameOrBefore(moment());
- if (mileageOver || dueForService)
+ if (dueForService)
return (
{t("contracts.labels.cardueforservice")}
- {`${nextservicekm} km`}
{nextservicedate}
@@ -282,7 +299,8 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
{() => {
const expires = form.getFieldValue("registrationexpires");
- const dateover = expires && moment(expires).isBefore(moment());
+ const dateover =
+ expires && moment(expires).endOf("day").isBefore(moment());
if (dateover)
return (
@@ -317,7 +335,8 @@ export default function CourtesyCarCreateFormComponent({ form, saveLoading }) {
{() => {
const expires = form.getFieldValue("insuranceexpires");
- const dateover = expires && moment(expires).isBefore(moment());
+ const dateover =
+ expires && moment(expires).endOf("day").isBefore(moment());
if (dateover)
return (