richardfogaca commented on code in PR #35683:
URL: https://github.com/apache/superset/pull/35683#discussion_r2670265377
##########
superset-frontend/plugins/plugin-chart-ag-grid-table/src/stateConversion.ts:
##########
@@ -68,6 +100,101 @@ function getTextComparator(type: string, value: string):
string {
return value;
}
+/**
+ * Format a date string to ISO format for SQL queries, preserving local
timezone.
+ * @param dateStr - Date string from AG Grid filter
+ * @returns ISO formatted date string in local timezone
+ */
+function formatDateForSQL(dateStr: string): string {
+ const date = new Date(dateStr);
+ if (Number.isNaN(date.getTime())) {
+ return dateStr;
+ }
+
+ const year = date.getFullYear();
+ const month = String(date.getMonth() + 1).padStart(2, '0');
+ const day = String(date.getDate()).padStart(2, '0');
+ const hours = String(date.getHours()).padStart(2, '0');
+ const minutes = String(date.getMinutes()).padStart(2, '0');
+ const seconds = String(date.getSeconds()).padStart(2, '0');
+
+ return `${year}-${month}-${day}T${hours}:${minutes}:${seconds}`;
+}
+
+/**
+ * Get the start of day (00:00:00) for a given date string
+ */
+function getStartOfDay(dateStr: string): string {
+ const date = new Date(dateStr);
+ date.setHours(0, 0, 0, 0);
+ return formatDateForSQL(date.toISOString());
+}
+
+/**
+ * Get the end of day (23:59:59) for a given date string
+ */
+function getEndOfDay(dateStr: string): string {
+ const date = new Date(dateStr);
+ date.setHours(23, 59, 59, 999);
+ return formatDateForSQL(date.toISOString());
+}
+
+/**
+ * Converts a date filter to SQL clause.
+ * Handles both standard operators (equals, lessThan, etc.) and
+ * custom server-side operators (serverEquals, serverBefore, etc.).
+ *
+ * @param colId - Column identifier
+ * @param filter - AG Grid date filter object
+ * @returns SQL clause string or null if conversion not possible
+ */
+function convertDateFilterToSQL(
Review Comment:
convertDateFilterToSQL appears to duplicate similar logic from
agGridFilterConverter.ts. consider consolidating into a shared utility
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]