mirror of
https://github.com/apache/superset.git
synced 2026-04-15 06:04:48 +00:00
feat(formatters): Add custom d3-time-format locale (#24263)
This commit is contained in:
@@ -21,7 +21,7 @@ import {
|
||||
isAdhocColumn,
|
||||
isPhysicalColumn,
|
||||
QueryFormMetric,
|
||||
smartDateFormatter,
|
||||
SMART_DATE_ID,
|
||||
t,
|
||||
validateNonEmpty,
|
||||
} from '@superset-ui/core';
|
||||
@@ -298,7 +298,7 @@ const config: ControlPanelConfig = {
|
||||
type: 'SelectControl',
|
||||
freeForm: true,
|
||||
label: t('Date format'),
|
||||
default: smartDateFormatter.id,
|
||||
default: SMART_DATE_ID,
|
||||
renderTrigger: true,
|
||||
choices: D3_TIME_FORMAT_OPTIONS,
|
||||
description: t('D3 time format for datetime columns'),
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
getTimeFormatter,
|
||||
getTimeFormatterForGranularity,
|
||||
QueryFormData,
|
||||
smartDateFormatter,
|
||||
SMART_DATE_ID,
|
||||
TimeFormats,
|
||||
} from '@superset-ui/core';
|
||||
import { getColorFormatters } from '@superset-ui/chart-controls';
|
||||
@@ -120,7 +120,7 @@ export default function transformProps(chartProps: ChartProps<QueryFormData>) {
|
||||
temporalColname: string,
|
||||
) => {
|
||||
let formatter: DateFormatter | undefined;
|
||||
if (dateFormat === smartDateFormatter.id) {
|
||||
if (dateFormat === SMART_DATE_ID) {
|
||||
if (granularity) {
|
||||
// time column use formats based on granularity
|
||||
formatter = getTimeFormatterForGranularity(granularity);
|
||||
|
||||
Reference in New Issue
Block a user