- Fetch not working in vercel because i add free plan key from exchangerate API and use HTTP not HTTPS, but work in local.
- React.js + TypeScript + Axios + CSS + Vite.
-
We Can Choose Start_Date & End_Date then fetch Data from exchangerate API.
-
After Choosing a Start&End Dates will display into a HTML Table of exchange rates for EGP and CAD currencies, One row per day of selected range.
-
Allows users to pick a starting date and an end date.
-
Provides validation to ensure that both start and end dates are provided.
-
Enforces the condition that the start date must be smaller than the end date - & reverse.
-
Handles fetching data from the API based on the selected date range.
-
Provides feedback to the user with error messages and a loading indicator during data fetching.
-
Allows users to select named ranges such as the last N days.
-
Clicking on a named range sets the start and end dates accordingly.
-
Provides flexibility for styling by allowing custom class name and inline styles for the component and the button.
-
Renders the button with a background color specified by the buttonBgColor prop.
-
Renders the fetched exchange rates in a table format with the date, EGP, and CAD rates.
-
Utilizes utility functions to get the current date and calculate the date of the last N days.
-
Proper error handling and feedback to the user in case of errors during data fetching.
<DateRangePicker
onChange={handleDateRangeChange}
dynamicRanges={dynamicRanges} // dynamic ranges
className="custom-date-picker" // Add custom class name
rangesButtonStyle={{ background: '#001684', color: '#fff' }} // Add custom button background color
style={{ }} // Add custom inline styles
fetchData={fetchData} // Pass the fetchData function as prop
/>
npm install
npm run dev
npm run build