Create Employee Change the date box into DatePicker.

This commit is contained in:
Kartik Sharma 2025-09-05 13:07:58 +05:30
parent e39355c6fd
commit 5c59ac3115

View File

@ -18,6 +18,7 @@ import {
import { clearApiCacheKey } from "../../slices/apiCacheSlice";
import { useMutation } from "@tanstack/react-query";
import Label from "../common/Label";
import DatePicker from "../common/DatePicker";
const mobileNumberRegex = /^[0-9]\d{9}$/;
@ -371,41 +372,43 @@ const ManageEmployee = ({ employeeId, onClosed, IsAllEmployee }) => {
)}
</div>
<div className="col-sm-4">
<Label className="form-text text-start" required>Birth Date</Label>
<Label className="form-text text-start" required>
Birth Date
</Label>
<div className="input-group">
<input
className="form-control form-control-sm"
type="date"
{...register("birthDate")}
id="birthDate"
<DatePicker
name="birthDate"
control={control} // from useForm()
placeholder="DD-MM-YYYY"
maxDate={new Date()} // restrict future dates (e.g., birth date must be today or past)
className="w-100"
/>
</div>
{errors.birthDate && (
<div
className="danger-text text-start"
style={{ fontSize: "12px" }}
>
<div className="danger-text text-start" style={{ fontSize: "12px" }}>
{errors.birthDate.message}
</div>
)}
</div>
<div className="col-sm-4">
<Label className="form-text text-start" required>Joining Date</Label>
<Label className="form-text text-start" required>
Joining Date
</Label>
<div className="input-group">
<input
className="form-control form-control-sm"
type="date"
{...register("joiningDate")}
id="joiningDate"
<DatePicker
name="joiningDate"
control={control} // from useForm()
placeholder="DD-MM-YYYY"
// For joining date, we dont block future dates
className="w-100"
/>
</div>
{errors.joiningDate && (
<div
className="danger-text text-start"
style={{ fontSize: "12px" }}
>
<div className="danger-text text-start" style={{ fontSize: "12px" }}>
{errors.joiningDate.message}
</div>
)}