feat : Added "Quarter" as a time unity to filter on date (#18289)
fixes #16674 Simply added the Quarter functionality to the existing filter code with months amount multiplied by 3. <img width="1258" height="760" alt="Screenshot 2026-02-27 at 11 59 26 AM" src="https://github.com/user-attachments/assets/30648259-2b72-480a-b8fa-55ed88d9ebf3" /> --------- Co-authored-by: Arun kumar <arunkumar@Aruns-MacBook-Air.local> Co-authored-by: Lucas Bordeau <bordeau.lucas@gmail.com>
This commit is contained in:
+9
-1
@@ -4,6 +4,7 @@ import {
|
||||
endOfHour,
|
||||
endOfMinute,
|
||||
endOfMonth,
|
||||
endOfQuarter,
|
||||
endOfSecond,
|
||||
endOfWeek,
|
||||
endOfYear,
|
||||
@@ -12,12 +13,14 @@ import {
|
||||
startOfHour,
|
||||
startOfMinute,
|
||||
startOfMonth,
|
||||
startOfQuarter,
|
||||
startOfSecond,
|
||||
startOfWeek,
|
||||
startOfYear,
|
||||
} from 'date-fns';
|
||||
import {
|
||||
addUnitToDateTime,
|
||||
assertUnreachable,
|
||||
getFirstDayOfTheWeekAsANumberForDateFNS,
|
||||
isDefined,
|
||||
type RelativeDateFilter,
|
||||
@@ -169,7 +172,12 @@ function evaluateThisDirection(
|
||||
start: startOfYear(now),
|
||||
end: endOfYear(now),
|
||||
});
|
||||
case 'QUARTER':
|
||||
return isWithinInterval(dateToCheck, {
|
||||
start: startOfQuarter(now),
|
||||
end: endOfQuarter(now),
|
||||
});
|
||||
default:
|
||||
return false;
|
||||
return assertUnreachable(unit);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user