-
Notifications
You must be signed in to change notification settings - Fork 273
Conversation
Codecov Report
@@ Coverage Diff @@
## master #38 +/- ##
==========================================
+ Coverage 99.11% 99.28% +0.17%
==========================================
Files 48 57 +9
Lines 450 560 +110
Branches 39 39
==========================================
+ Hits 446 556 +110
Misses 2 2
Partials 2 2
Continue to review full report at Codecov.
|
3718129
to
ab70b9b
Compare
Just made updates and this one should be ready to review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
overall lgtm! had a couple minor comments.
} | ||
|
||
// Create new formatter if does not exist | ||
const useLocalTime = targetFormat.startsWith(LOCAL_PREFIX); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what do you think about having the user pass useLocalTime
directly as a parameter instead of encoding in the format string? It seems a little more clear api-wise and would simplify splicing local!
out, but also makes the format(format, value)
signature become more complex.
given those tradeoffs I'd be okay with either, just thought I'd mention it. also not sure if Superset already uses !local
and in any case it would probably be pretty straight forward to refactor in the future, too, if it was an issue. If we do keep !local
, could we add a test for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are factories which will take useLocalTime
directly as parameter, which is the underlying way to construct a formatter.
I intended for the interface of the registry
's format
to be closest to current superset and provide backwards compatibility to how d3FormatString
is stored as a single string in the database. If we introduce useLocalTime
as another field then we need a separate control and another field to store in db.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I didn't realize this complexity, makes sense 👍
Squashed commits: [5fae1ed] fix lint [7672544] support local and utc [c33fae7] update unit tests [97fdc0d] fix all unit tests [88e8029] add formatter code [a33c76c] initialize
ab70b9b
to
9a82ed9
Compare
* chore: add tags and description * Update packages/superset-ui-legacy-preset-chart-deckgl/src/layers/Arc/index.js Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com> * Update packages/superset-ui-legacy-preset-chart-deckgl/src/layers/Hex/index.js Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com> * Update packages/superset-ui-legacy-preset-chart-deckgl/src/layers/Scatter/index.js Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com> * Update packages/superset-ui-legacy-preset-chart-deckgl/src/layers/Screengrid/index.js Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com> Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>
* chore: add tags and description * Update packages/superset-ui-legacy-preset-chart-deckgl/src/layers/Arc/index.js Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com> * Update packages/superset-ui-legacy-preset-chart-deckgl/src/layers/Hex/index.js Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com> * Update packages/superset-ui-legacy-preset-chart-deckgl/src/layers/Scatter/index.js Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com> * Update packages/superset-ui-legacy-preset-chart-deckgl/src/layers/Screengrid/index.js Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com> Co-authored-by: David Aaron Suddjian <1858430+suddjian@users.noreply.github.com>
🏆 Enhancements
Add
@superset-ui/time-format
, a module for formatting time. FunctionsgetTimeFormatter
andformatTime
should be used instead of callingd3.format
directly.or
It is powered by a registry to support registration of custom formatting, with fallback to
d3.utcFormat
ord3.timeFormat
(if the formatId starts withlocal!
)It also define constants for common d3 time formats. See
TimeFormats.js
.