amaannawab923 commented on code in PR #36270:
URL: https://github.com/apache/superset/pull/36270#discussion_r2667777563
##########
superset-frontend/plugins/plugin-chart-ag-grid-table/src/utils/dateFilterComparator.ts:
##########
@@ -17,25 +17,50 @@
* under the License.
*/
+/**
+ * Timezone-safe date comparator for AG Grid date filters.
+ *
+ * This comparator normalizes both dates to UTC midnight before comparison,
+ * fixing the off-by-one day bug that occurs when:
+ * - User's timezone differs from UTC
+ * - Data is stored in UTC but filtered in local time
+ * - Midnight boundary crossing due to timezone offset
+ *
+ * Bug references:
+ * - AG Grid Issue #8611: UTC Date Editor Problem
+ * - AG Grid Issue #3921: DateFilter timezone regression
+ *
+ */
const dateFilterComparator = (filterDate: Date, cellValue: Date) => {
+ if (cellValue == null) {
+ return -1;
+ }
Review Comment:
Good catch! You're right that the type was misleading. AG Grid can pass null
or undefined to the comparator at runtime for cells with empty/missing values,
so the check is necessary.
--
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]