raphaelsales commented on issue #43847:
URL: https://github.com/apache/superset/issues/43847#issuecomment-5543999558

   @LeonxLJX heads-up before you dig in, so you don't lose time: this one is in 
the frontend, not in a Python date parser — `dateutil`/`arrow` aren't in this 
path.
   
   The parsing happens in 
`superset-frontend/packages/superset-ui-core/src/time-format/utils/stringifyTimeInput.ts`,
 which treats any string matching `/^-?\d+$/` as epoch **milliseconds**:
   
   ```ts
   const trimmed = value.trim();
   const isIntegerString = /^-?\d+$/.test(trimmed);
   return fn(new Date(isIntegerString ? Number(trimmed) : value));
   ```
   
   Also worth correcting the repro: `"2017-01-01"` is fine — it has separators, 
so the regex doesn't match and `new Date(value)` handles it. It's the bare 
digits-only values that break:
   
   | input | `getTimeFormatter('%Y-%m-%d')` |
   | --- | --- |
   | `"2017-01-01"` | `2017-01-01` |
   | `"2017"` | `1970-01-01` |
   | `"20260903"` | `1970-01-01` |
   
   One coordination note: #43839 (open, awaiting review) already modifies this 
same function — it adds a fallback for strings that don't resolve to a valid 
date at all. Whatever shape the fix here takes will touch the same lines, so 
they're probably better landed in sequence than in parallel.
   


-- 
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]

Reply via email to