You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bb...@apache.org on 2026/09/18 18:37:25 UTC
(airflow) branch main updated: Keep date-only range ends inclusive (#72860)
This is an automated email from the ASF dual-hosted git repository.
bbovenzi pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new cd1f0e66277 Keep date-only range ends inclusive (#72860)
cd1f0e66277 is described below
commit cd1f0e66277fddca9003ba1c615a6c4ba69f30c9
Author: Lin Junrong <no...@gmail.com>
AuthorDate: Sat Sep 19 02:37:15 2026 +0800
Keep date-only range ends inclusive (#72860)
---
.../FilterBar/filters/DateRangeFilter.test.tsx | 27 ++++++++++++++++++++++
.../src/airflow/ui/src/hooks/useDateRangeFilter.ts | 10 ++++++--
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/airflow-core/src/airflow/ui/src/components/FilterBar/filters/DateRangeFilter.test.tsx b/airflow-core/src/airflow/ui/src/components/FilterBar/filters/DateRangeFilter.test.tsx
index 6e2de0f8763..6ee49836dd4 100644
--- a/airflow-core/src/airflow/ui/src/components/FilterBar/filters/DateRangeFilter.test.tsx
+++ b/airflow-core/src/airflow/ui/src/components/FilterBar/filters/DateRangeFilter.test.tsx
@@ -148,6 +148,33 @@ describe("DateRangeFilter", () => {
cleanup();
});
+ it("includes the whole end date when its time is empty", async () => {
+ const onChange = vi.fn();
+
+ renderFilter({ ...defaultProps, onChange });
+ const { endDateInput } = getInputs();
+
+ changeDateInput(endDateInput, "2024/01/15");
+
+ await waitFor(() => {
+ expect(onChange).toHaveBeenLastCalledWith({
+ endDate: "2024-01-15T23:59:59.999Z",
+ startDate: undefined,
+ });
+ });
+ });
+
+ it("accepts a start time on the end date when the end time is empty", async () => {
+ renderFilter();
+ const { endDateInput, startDateInput, startTimeInput } = getInputs();
+
+ changeDateInput(startDateInput, "2024/01/15");
+ changeTimeInput(startTimeInput, "10:00");
+ changeDateInput(endDateInput, "2024/01/15");
+
+ await waitForNoError("Start date/time must be before end date/time");
+ });
+
describe("Input Validation", () => {
it("validates date and time formats", async () => {
renderFilter();
diff --git a/airflow-core/src/airflow/ui/src/hooks/useDateRangeFilter.ts b/airflow-core/src/airflow/ui/src/hooks/useDateRangeFilter.ts
index ed707c2663c..b061fc1b41a 100644
--- a/airflow-core/src/airflow/ui/src/hooks/useDateRangeFilter.ts
+++ b/airflow-core/src/airflow/ui/src/hooks/useDateRangeFilter.ts
@@ -189,7 +189,10 @@ export const useDateRangeFilter = ({ onChange, translate, value }: UseDateRangeF
const startDateTime = combineDateAndTime(inputs.start, inputs.startTime, {
timezone: selectedTimezone,
});
- const endDateTime = combineDateAndTime(inputs.end, inputs.endTime, { timezone: selectedTimezone });
+ const endDateTime = combineDateAndTime(inputs.end, inputs.endTime, {
+ endOfDay: true,
+ timezone: selectedTimezone,
+ });
if (Boolean(startDateTime) && Boolean(endDateTime) && !validateDateRange(startDateTime, endDateTime)) {
errors.push({
@@ -276,7 +279,10 @@ export const useDateRangeFilter = ({ onChange, translate, value }: UseDateRangeF
const timeStr = field === "start" ? newInputs.startTime : newInputs.endTime;
if (dayjs(dateStr, DATE_INPUT_FORMAT, true).isValid()) {
- const combinedDateTime = combineDateAndTime(dateStr, timeStr, { timezone: selectedTimezone });
+ const combinedDateTime = combineDateAndTime(dateStr, timeStr, {
+ endOfDay: field === "end",
+ timezone: selectedTimezone,
+ });
if (Boolean(combinedDateTime)) {
onChange({