[offers][fix] Fix year options (#548)
parent
ff54652f54
commit
1db5e46fcf
@ -1,8 +1,12 @@
|
|||||||
const NUM_YEARS = 5;
|
const NUM_YEARS = 5;
|
||||||
export const FutureYearsOptions = Array.from({ length: NUM_YEARS }, (_, i) => {
|
const OFFSET = 2;
|
||||||
const year = new Date().getFullYear() + i;
|
export const YearsOptions = (yearSelected?: number) =>
|
||||||
|
Array.from({ length: NUM_YEARS }, (_, i) => {
|
||||||
|
const year = yearSelected
|
||||||
|
? yearSelected - OFFSET + i
|
||||||
|
: new Date().getFullYear() - OFFSET + i;
|
||||||
return {
|
return {
|
||||||
label: String(year),
|
label: String(year),
|
||||||
value: year,
|
value: year,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in new issue