I wanted to select the Month and Year only BUT I wanted to output the first day of the selected month and year and the last day of the selected month and year. Output dates should be complete. They are fromDate
and toDate
.
For example: if Jan 2021 is chosen then
fromDate is 01-01-2021
toDate is 31-01-2021
Pls check my codesandbox here CLICK HERE
You can modify the months
and years
array since they are static. Modify in the best way possible.
<div style=>
<h3> Month </h3>
<Select onChange={(e) => select(e)}>
{months.map((key, index) => (
<option value={key} key={index}>
{key}
</option>
))}
</Select>
<h3> Year </h3>
<Select onChange={(e) => select(e)}>
{years.map((key, index) => (
<option value={key} key={index}>
{key}
</option>
))}
</Select>
</div>
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment