diff --git a/web-common/src/components/data-graphic/compositions/timestamp-profile/TimestampBound.svelte b/web-common/src/components/data-graphic/compositions/timestamp-profile/TimestampBound.svelte index ac793d5e182..03657e76dec 100644 --- a/web-common/src/components/data-graphic/compositions/timestamp-profile/TimestampBound.svelte +++ b/web-common/src/components/data-graphic/compositions/timestamp-profile/TimestampBound.svelte @@ -20,16 +20,22 @@ datePortion, timePortion, } from "@rilldata/web-common/lib/formatters"; + import { timeGrainToDuration } from "@rilldata/web-common/lib/time/grains"; import { removeLocalTimezoneOffset } from "@rilldata/web-common/lib/time/timezone"; + import type { V1TimeGrain } from "@rilldata/web-common/runtime-client"; export let value: Date; + export let grain: V1TimeGrain; export let label = "value"; export let align: "left" | "right" = "left"; let valueWithoutOffset: Date | undefined; $: if (value instanceof Date) - valueWithoutOffset = removeLocalTimezoneOffset(value); + valueWithoutOffset = removeLocalTimezoneOffset( + value, + timeGrainToDuration(grain), + ); @@ -496,8 +499,18 @@
- - + +
diff --git a/web-common/src/components/data-graphic/compositions/timestamp-profile/TimestampMouseoverAnnotation.svelte b/web-common/src/components/data-graphic/compositions/timestamp-profile/TimestampMouseoverAnnotation.svelte index 909bd4f9b25..635a185e1d8 100644 --- a/web-common/src/components/data-graphic/compositions/timestamp-profile/TimestampMouseoverAnnotation.svelte +++ b/web-common/src/components/data-graphic/compositions/timestamp-profile/TimestampMouseoverAnnotation.svelte @@ -4,8 +4,10 @@ formatInteger, timePortion, } from "@rilldata/web-common/lib/formatters"; - import type { ScaleLinear } from "d3-scale"; + import { timeGrainToDuration } from "@rilldata/web-common/lib/time/grains"; import { removeLocalTimezoneOffset } from "@rilldata/web-common/lib/time/timezone"; + import type { V1TimeGrain } from "@rilldata/web-common/runtime-client"; + import type { ScaleLinear } from "d3-scale"; import { getContext } from "svelte"; import type { Writable } from "svelte/store"; import { fly } from "svelte/transition"; @@ -25,7 +27,11 @@ export let point; export let xAccessor: string; export let yAccessor: string; - $: xLabel = removeLocalTimezoneOffset(point[xAccessor]); + export let grain: V1TimeGrain; + $: xLabel = removeLocalTimezoneOffset( + point[xAccessor], + timeGrainToDuration(grain), + ); diff --git a/web-common/src/features/dashboards/pivot/pivot-column-definition.ts b/web-common/src/features/dashboards/pivot/pivot-column-definition.ts index a4cb6d55f2d..3cbe90cdc1c 100644 --- a/web-common/src/features/dashboards/pivot/pivot-column-definition.ts +++ b/web-common/src/features/dashboards/pivot/pivot-column-definition.ts @@ -2,6 +2,7 @@ import PercentageChange from "@rilldata/web-common/components/data-types/Percent import { createMeasureValueFormatter } from "@rilldata/web-common/lib/number-formatting/format-measure-value"; import { formatMeasurePercentageDifference } from "@rilldata/web-common/lib/number-formatting/percentage-formatter"; import { TIME_GRAIN } from "@rilldata/web-common/lib/time/config"; +import { timeGrainToDuration } from "@rilldata/web-common/lib/time/grains"; import { addZoneOffset, removeLocalTimezoneOffset, @@ -91,7 +92,10 @@ function createColumnDefinitionForDimensions( ) { const timeGrain = getTimeGrainFromDimension(dimensionNames?.[level]); const dt = addZoneOffset( - removeLocalTimezoneOffset(new Date(value)), + removeLocalTimezoneOffset( + new Date(value), + timeGrainToDuration(timeGrain), + ), timeConfig?.timeZone, ); const timeFormatter = timeFormat( @@ -150,7 +154,10 @@ function formatRowDimensionValue( if (value === "Total") return "Total"; const timeGrain = getTimeGrainFromDimension(dimension); const dt = addZoneOffset( - removeLocalTimezoneOffset(new Date(value)), + removeLocalTimezoneOffset( + new Date(value), + timeGrainToDuration(timeGrain), + ), timeConfig?.timeZone, ); const timeFormatter = timeFormat( diff --git a/web-common/src/features/dashboards/time-dimension-details/charts/TDDAlternateChart.svelte b/web-common/src/features/dashboards/time-dimension-details/charts/TDDAlternateChart.svelte index 33b5c8d83db..58871060c83 100644 --- a/web-common/src/features/dashboards/time-dimension-details/charts/TDDAlternateChart.svelte +++ b/web-common/src/features/dashboards/time-dimension-details/charts/TDDAlternateChart.svelte @@ -1,5 +1,11 @@