Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
SemenStruchev committed Sep 18, 2024
1 parent 177efe5 commit e9209a1
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/DatePicker/RelativeDateRange.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,13 @@ export const dateRanges = {
};

// List of future date options
const futureDates = [options.NEXT_DAY, options.NEXT_WEEK, options.NEXT_MONTH, options.NEXT_QUARTER, options.NEXT_YEAR];
const futureDates = new Set([
options.NEXT_DAY,
options.NEXT_WEEK,
options.NEXT_MONTH,
options.NEXT_QUARTER,
options.NEXT_YEAR,
]);

const handlers = {
[options.YESTERDAY]: (timezone) => {
Expand Down Expand Up @@ -246,8 +252,8 @@ export const RelativeDateRange = ({

const filterFutureDates = (options) => {
if (!isFutureDatesAllowed) {
// Filter out options if they are in the futureDates array
return options.filter((option) => !futureDates.includes(option.value));
// Filter out options if they are in the futureDates Set
return options.filter((option) => !futureDates.has(option.value));
}

return options;
Expand Down Expand Up @@ -284,5 +290,5 @@ RelativeDateRange.propTypes = {
showApply: PropTypes.bool,
value: PropTypes.string,
timezoneName: PropTypes.string,
isFutureDatesAllowed: PropTypes.bool, // New prop type
isFutureDatesAllowed: PropTypes.bool,
};

0 comments on commit e9209a1

Please sign in to comment.