Skip to content

Commit 0d2d2e8

Browse files
authored
Merge pull request #21 from ClassConnect-org/dev
Dev
2 parents af5bba3 + ac629ba commit 0d2d2e8

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

src/components/RuleFormModal.tsx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ const RuleFormModal: React.FC<Props> = ({ initialData, onClose, onSubmit }) => {
1313
const [effectiveDate, setEffectiveDate] = useState("");
1414
const [conditions, setConditions] = useState<string[]>([]);
1515
const [newCondition, setNewCondition] = useState("");
16+
const tomorrow = new Date();
17+
tomorrow.setDate(tomorrow.getDate() + 1);
18+
const minDate = tomorrow.toISOString().split("T")[0];
1619

1720
useEffect(() => {
1821
if (initialData) {
@@ -90,13 +93,14 @@ const RuleFormModal: React.FC<Props> = ({ initialData, onClose, onSubmit }) => {
9093

9194
<div>
9295
<label className="block text-sm font-medium text-gray-700 mb-1">Effective date</label>
93-
<input
94-
type="date"
95-
value={effectiveDate}
96-
onChange={(e) => setEffectiveDate(e.target.value)}
97-
className="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
98-
required
99-
/>
96+
<input
97+
type="date"
98+
value={effectiveDate}
99+
onChange={(e) => setEffectiveDate(e.target.value)}
100+
min={minDate}
101+
className="w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500"
102+
required
103+
/>
100104
</div>
101105

102106
<div>

0 commit comments

Comments
 (0)