From 069bec2dafc37a4f1ded0c958defa9f378d44a1f Mon Sep 17 00:00:00 2001 From: Carson Date: Tue, 26 Nov 2024 14:11:41 -0800 Subject: [PATCH] Update min date for date filter (#13676) GitOrigin-RevId: 3252522c26a1bbf3a191baa0555a845c946565b6 --- .../ui/src/components/DataManagerTable/DateWidget.tsx | 11 ++++++++++- .../ui/src/components/DataManagerTable/date_utils.ts | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/packages/ui/src/components/DataManagerTable/DateWidget.tsx b/packages/ui/src/components/DataManagerTable/DateWidget.tsx index b17b62b8..13ab5829 100644 --- a/packages/ui/src/components/DataManagerTable/DateWidget.tsx +++ b/packages/ui/src/components/DataManagerTable/DateWidget.tsx @@ -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; @@ -95,6 +99,7 @@ export const DateWidget = ({ onCalendarOpen={handleCalendarOpen} onCalendarClose={handleCalendarClose} value={dates} + minDate={MIN_DATE} /> ); } else { @@ -105,6 +110,7 @@ export const DateWidget = ({ onCalendarClose={handleCalendarClose} value={dates} disableClock + minDate={MIN_DATE} /> ); } @@ -116,6 +122,7 @@ export const DateWidget = ({ onCalendarOpen={handleCalendarOpen} onCalendarClose={handleCalendarClose} value={dates as Date} + minDate={MIN_DATE} /> ); break; @@ -128,6 +135,7 @@ export const DateWidget = ({ onCalendarOpen={handleCalendarOpen} onCalendarClose={handleCalendarClose} value={dates as Date} + minDate={MIN_DATE} /> ); } else { @@ -138,6 +146,7 @@ export const DateWidget = ({ onCalendarClose={handleCalendarClose} value={dates as Date} disableClock + minDate={MIN_DATE} /> ); } diff --git a/packages/ui/src/components/DataManagerTable/date_utils.ts b/packages/ui/src/components/DataManagerTable/date_utils.ts index de176572..48800e2c 100644 --- a/packages/ui/src/components/DataManagerTable/date_utils.ts +++ b/packages/ui/src/components/DataManagerTable/date_utils.ts @@ -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,