Skip to content

Commit

Permalink
Update min date for date filter (#13676)
Browse files Browse the repository at this point in the history
GitOrigin-RevId: 3252522c26a1bbf3a191baa0555a845c946565b6
  • Loading branch information
carsonp6 authored and Lightspark Eng committed Nov 26, 2024
1 parent 0d965a4 commit 069bec2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion packages/ui/src/components/DataManagerTable/DateWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ import { getTypographyString } from "../../styles/tokens/typography.js";
import { z } from "../../styles/z-index.js";
import { Icon } from "../Icon/Icon.js";
import { LabelModerate } from "../typography/LabelModerate.js";
import { DateRangeOperation, type CustomDateRangeData } from "./date_utils.js";
import {
DateRangeOperation,
MIN_DATE,
type CustomDateRangeData,
} from "./date_utils.js";

type DateOrNull = Date | null;

Expand Down Expand Up @@ -95,6 +99,7 @@ export const DateWidget = ({
onCalendarOpen={handleCalendarOpen}
onCalendarClose={handleCalendarClose}
value={dates}
minDate={MIN_DATE}
/>
);
} else {
Expand All @@ -105,6 +110,7 @@ export const DateWidget = ({
onCalendarClose={handleCalendarClose}
value={dates}
disableClock
minDate={MIN_DATE}
/>
);
}
Expand All @@ -116,6 +122,7 @@ export const DateWidget = ({
onCalendarOpen={handleCalendarOpen}
onCalendarClose={handleCalendarClose}
value={dates as Date}
minDate={MIN_DATE}
/>
);
break;
Expand All @@ -128,6 +135,7 @@ export const DateWidget = ({
onCalendarOpen={handleCalendarOpen}
onCalendarClose={handleCalendarClose}
value={dates as Date}
minDate={MIN_DATE}
/>
);
} else {
Expand All @@ -138,6 +146,7 @@ export const DateWidget = ({
onCalendarClose={handleCalendarClose}
value={dates as Date}
disableClock
minDate={MIN_DATE}
/>
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/components/DataManagerTable/date_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const GRANULARITY_TO_MILLIS: { [key in TimeGranularity]: number } = {
};

export const MAX_DATE = new Date("3000-01-01");
export const MIN_DATE = new Date("1900-01-01");
export const MIN_DATE = new Date("1970-01-01");

export const subtractTime = (
date: Date,
Expand Down

0 comments on commit 069bec2

Please sign in to comment.