diff --git a/surfsense_web/components/assistant-ui/connector-popup/components/date-range-selector.tsx b/surfsense_web/components/assistant-ui/connector-popup/components/date-range-selector.tsx index 48dc2a6c2..7490aa959 100644 --- a/surfsense_web/components/assistant-ui/connector-popup/components/date-range-selector.tsx +++ b/surfsense_web/components/assistant-ui/connector-popup/components/date-range-selector.tsx @@ -15,6 +15,7 @@ interface DateRangeSelectorProps { onStartDateChange: (date: Date | undefined) => void; onEndDateChange: (date: Date | undefined) => void; allowFutureDates?: boolean; // Allow future dates for calendar connectors + lastIndexedAt?: string | null; // Last sync timestamp to show in default placeholder } export const DateRangeSelector: FC = ({ @@ -23,7 +24,21 @@ export const DateRangeSelector: FC = ({ onStartDateChange, onEndDateChange, allowFutureDates = false, + lastIndexedAt, }) => { + // Get the placeholder text for start date based on whether connector was previously indexed + const getStartDatePlaceholder = () => { + if (lastIndexedAt) { + const date = new Date(lastIndexedAt); + const currentYear = new Date().getFullYear(); + const indexedYear = date.getFullYear(); + // Show year only if different from current year + const formatStr = indexedYear === currentYear ? "MMM d, HH:mm" : "MMM d, yyyy HH:mm"; + const formattedDate = format(date, formatStr); + return `Since (${formattedDate})`; + } + return "Default (1 year ago)"; + }; const handleLast30Days = () => { const today = new Date(); onStartDateChange(subDays(today, 30)); @@ -73,7 +88,7 @@ export const DateRangeSelector: FC = ({ )} > - {startDate ? format(startDate, "PPP") : "Default (1 year ago)"} + {startDate ? format(startDate, "PPP") : getStartDatePlaceholder()} diff --git a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx index 430aa927c..cfdebee60 100644 --- a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx +++ b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/connector-edit-view.tsx @@ -227,6 +227,7 @@ export const ConnectorEditView: FC = ({ connector.connector_type === "COMPOSIO_GOOGLE_CALENDAR_CONNECTOR" || connector.connector_type === "LUMA_CONNECTOR" } + lastIndexedAt={connector.last_indexed_at} /> )} diff --git a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/indexing-configuration-view.tsx b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/indexing-configuration-view.tsx index 72069441a..b885f35da 100644 --- a/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/indexing-configuration-view.tsx +++ b/surfsense_web/components/assistant-ui/connector-popup/connector-configs/views/indexing-configuration-view.tsx @@ -165,6 +165,7 @@ export const IndexingConfigurationView: FC = ({ config.connectorType === "COMPOSIO_GOOGLE_CALENDAR_CONNECTOR" || config.connectorType === "LUMA_CONNECTOR" } + lastIndexedAt={connector?.last_indexed_at} /> )}