rusackas commented on code in PR #43909:
URL: https://github.com/apache/superset/pull/43909#discussion_r3943088966
##########
superset-frontend/packages/superset-ui-core/src/time-format/utils/stringifyTimeInput.ts:
##########
@@ -28,16 +28,27 @@ export default function stringifyTimeInput(
let time: Date;
if (typeof value === 'string') {
const trimmed = value.trim();
+ // A bare four-digit string is the ISO 8601 year-only form ("2017"), which
+ // every engine parses as January 1st of that year. Any other integer
+ // string is an epoch timestamp in milliseconds that was stringified on
+ // its way here, e.g. by the pivot table, and is not a valid Date input.
+ const isYear = /^\d{4}$/.test(trimmed);
Review Comment:
Good catch @sadpandajoe, thanks! The header coercion in `TableRenderers` now
skips bare four-digit strings so they reach the year handling in core, while
stringified epochs still coerce. Added row and column header tests with a real
`%Y` formatter, both red before this.
--
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]