mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 07:38:10 +00:00
fix
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { Loader2, Calendar, ShieldCheck } from "lucide-react";
|
||||
import { Loader2, ShieldCheck } from "lucide-react";
|
||||
import {
|
||||
Alert,
|
||||
Badge,
|
||||
@@ -14,7 +14,6 @@ import {
|
||||
Text,
|
||||
Textarea,
|
||||
TextInput,
|
||||
ActionIcon,
|
||||
} from "@mantine/core";
|
||||
|
||||
import {
|
||||
@@ -238,6 +237,12 @@ const FleetFormDialog = ({
|
||||
const date = new Date(stringValue + "T00:00:00Z");
|
||||
if (isNaN(date.getTime())) {
|
||||
next[field.name] = `${field.label} is not a valid date`;
|
||||
} else if (field.dateBound === "future") {
|
||||
const startOfToday = new Date();
|
||||
startOfToday.setUTCHours(0, 0, 0, 0);
|
||||
if (date <= startOfToday) {
|
||||
next[field.name] = `${field.label} must be in the future`;
|
||||
}
|
||||
} else if (date > new Date()) {
|
||||
next[field.name] = `${field.label} cannot be in the future`;
|
||||
}
|
||||
@@ -402,11 +407,6 @@ const FleetFormDialog = ({
|
||||
error={error}
|
||||
disabled={isDisabled}
|
||||
description={field.description || "Select a date"}
|
||||
rightSection={
|
||||
<ActionIcon size="sm" variant="subtle" color="green">
|
||||
<Calendar size={16} />
|
||||
</ActionIcon>
|
||||
}
|
||||
size="sm"
|
||||
radius="md"
|
||||
styles={{
|
||||
|
||||
Reference in New Issue
Block a user