SEPURI-SAI-KRISHNA opened a new pull request, #45410:
URL: https://github.com/apache/superset/pull/45410

   ### SUMMARY
   
   Fixes #45409.
   
   `table()` in `superset/charts/client_processing.py`, the backend mirror of 
the
   Table plugin used for `POST_PROCESSED` report data, applied `d3NumberFormat` 
and
   `currencyFormat` but had no `d3TimeFormat` branch, so a column with an 
explicit
   time format was left raw in email and Slack reports while the browser 
formatted
   it.
   
   This adds the explicit `d3TimeFormat` branch as the first check in the 
per-column
   loop, mirroring the order in `plugin-chart-table/src/transformProps.ts`
   (`if (isTime || config.d3TimeFormat)`). It is scoped to datetime columns 
with an
   explicit format and applied with `strftime`, which shares its common 
directives
   (`%Y`, `%m`, `%d`, `%H`, `%M`, `%S`, ...) with d3-time-format. A non-datetime
   column carrying the key is left untouched, and null (`NaT`) is preserved.
   
   The wider browser behaviour (bare `isTime`, the `tableTimestampFormat` 
default,
   `SMART_DATE` granularity, and string temporal columns) is intentionally out 
of
   scope; it needs a full server-side d3-time-format port and is a larger change
   for reports.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   With `column_config = {"ds": {"d3TimeFormat": "%Y"}, "SUM(num)": 
{"d3NumberFormat": ",.2f"}}`:
   
   Before:
   
   ```
   ds                     SUM(num)
   2024-01-15 13:45:00    1,234,567.00
   ```
   
   After:
   
   ```
   ds      SUM(num)
   2024    1,234,567.00
   ```
   
   ### TESTING INSTRUCTIONS
   
   ```
   pytest tests/unit_tests/charts/test_client_processing.py -k table
   ```
   
   New `test_table_applies_time_format_alongside_number_format` fails without 
the
   branch (the timestamp is left raw) and passes with it; the number column is
   formatted on the same call, confirming the branch does not disturb number
   formatting.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: #45409
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


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