sadpandajoe commented on code in PR #45410:
URL: https://github.com/apache/superset/pull/45410#discussion_r4322385141
##########
superset/charts/client_processing.py:
##########
@@ -73,6 +75,27 @@
# The Excel equivalent, applied as a cell format so the value stays numeric.
EXCEL_PERCENT_FORMAT = "0.0%"
+# "Adaptive formatting" in the time format controls, mirroring
``SMART_DATE_ID``
+# in ``superset-ui-core/time-format``. It is an alias the browser resolves to a
+# formatter that picks a representation per value, not a format string.
+SMART_DATE = "smart_date"
+
+# ``strftime`` copies a directive it does not recognize into its output
+# verbatim, so a d3-only one would reach the report as literal text: ``%L`` and
+# ``%q`` stay ``%L`` and ``%q`` rather than becoming milliseconds and a
quarter.
+# These are the directives that carry the same meaning in d3-time-format and in
+# ``strftime``. Left out are the locale-composite ones (``%c``, ``%x``,
``%X``),
+# whose output follows the server's locale rather than the chart's, and the
+# platform-dependent or d3-only ones (``%e``, ``%g``, ``%L``, ``%q``, ``%Q``,
+# ``%s``, ``%Z``, ``%z``).
+SHARED_TIME_DIRECTIVES = frozenset("aAbBdfGHIjmMpSuUVwWyY%")
Review Comment:
`%a`, `%A`, `%b`, `%B` and `%p` are only the same in both implementations
while the browser uses d3's English defaults. `D3_TIME_FORMAT` in
`superset/config.py` can override `days`, `months`, `shortMonths` and
`periods`, and the chart then uses those names while `strftime` uses the
worker's `LC_TIME`. With French `months` configured on a C-locale worker,
`2024-01-15` with `%B %Y` shows `janvier 2024` in the chart but `January 2024`
in the report. Should these directives leave the column raw (as the
locale-composite ones do), or should the configured names be applied?
--
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]