Implement date range feature with disabled out-of-range dates

This commit is contained in:
Srinath 2026-03-23 10:47:26 +05:30
parent aa2a3b3c79
commit 46ff0f8d27
2 changed files with 15 additions and 2 deletions

View File

@ -12,6 +12,7 @@ import { uploadImage } from "../../../../../Features/upload/upload";
import { SelfBookingEmailSendLink } from "../../../../../Features/ConfigMasterPage/ConfigMasterPage";
import { Messages } from "../../../../../Components/Notifications/Messages";
const { RangePicker } = DatePicker;
import dayjs from "dayjs";
const uploadApiUrl = import.meta.env.ENV_IMAGE_UPLOAD_API_URL;
const ReprintPDFDataShare = ({ printDatas, printerTemplateStyle, SettingDataSelector, open = false, onClose = () => { } }) => {
@ -40,7 +41,9 @@ const ReprintPDFDataShare = ({ printDatas, printerTemplateStyle, SettingDataSele
fetchData(dateStrings);
}
};
const disabledDate = (current) => {
return current && current > dayjs().endOf("day");
};
const fetchData = async (dates = dateStrings) => {
setIsFetching(true);
try {
@ -184,8 +187,9 @@ Thank you for choosing us!`;
<div>
<RangePicker
placeholder={['Start Date', 'End Date']}
format="YYYY-MM-DD"
format="DD-MM-YYYY"
onChange={handleDateChange}
disabledDate={disabledDate}
/>
</div>
<div>

View File

@ -606,6 +606,8 @@ const ProductExcel = ({
const [loading, setLoading] = useState(false);
const [message, setMessage] = useState(false);
const [Datas, setDatas] = useState();
console.log(Datas, 'Datas32323232');
const [currentPage, setCurrentPage] = useState(1);
const [MappingOpen, setMappingOpen] = useState(false);
const [fieldMapping, setFieldMapping] = useState({});
@ -843,6 +845,7 @@ const ProductExcel = ({
};
const handleFileUpload = (e) => {
const file = e.target.files[0];
const reader = new FileReader();
@ -999,6 +1002,12 @@ const ProductExcel = ({
item['Product Varient Name'] === undefined
? 'Variant 1'
: item['Product Varient Name'],
'Manufacture Date':
item['Manufacture Date'] == 'NaN-NaN-NaN' ? '' : item['Manufacture Date'],
'Expire Date':
item['Expire Date'] == 'NaN-NaN-NaN' ? '' : item['Expire Date'],
'Available From':
item['Available From'] == 'NaN-NaN-NaN' ? '' : item['Available From'],
'Available To':
item['Available To'] == 'NaN-NaN-NaN' ? '' : item['Available To'],
ProdId: item['ProdId'] || null,