Skip to content

Support combining numeric formats#397

Merged
jpettitt merged 1 commit into
masterfrom
issue-385-format-pipeline
Jul 6, 2026
Merged

Support combining numeric formats#397
jpettitt merged 1 commit into
masterfrom
issue-385-format-pipeline

Conversation

@jpettitt

@jpettitt jpettitt commented Jul 6, 2026

Copy link
Copy Markdown
Collaborator

Summary

Comma-separated numeric formats now compose as a pipeline: format: invert, precision3, kilo, precision1, invert, kilo3. The raw number threads through every segment and is locale-formatted exactly once at the end. An explicit precision<N> controls decimals wherever it appears; otherwise the last segment's own default applies; otherwise source decimals are preserved. Only number-transforming formats compose — durations/timestamps/text transforms fall through unchanged.

The visual editor's Format dropdown gains a Custom… option revealing a free-text field, which also protects YAML-only format strings (pipelines, precision7) from being clobbered when the row is edited through the form.

Fixes #385.

Test plan

  • yarn build (lint + type-check + 186 tests + webpack) passes; 14 new tests
  • Verified live in a local HA instance

Comma-separated numeric formats compose as a pipeline (invert,
precision3): the raw number threads through every segment and is
locale-formatted once at the end. Explicit precision wins wherever it
appears; otherwise the last segment's default applies. The editor's
format dropdown gains a Custom… option with a free-text field, which
also keeps YAML-only format strings from being clobbered by form edits.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@jpettitt jpettitt merged commit addfa06 into master Jul 6, 2026
2 checks passed
@jpettitt jpettitt deleted the issue-385-format-pipeline branch July 6, 2026 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

invert looses precision with last update 4.6.0

1 participant