diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/server/__tests__/formatter.test.ts b/packages/plugins/@nocobase/plugin-data-visualization/src/server/__tests__/formatter.test.ts index 0230c0f74..4a3730605 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/server/__tests__/formatter.test.ts +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/server/__tests__/formatter.test.ts @@ -71,7 +71,6 @@ describe('formatter', () => { const ctx = { app, db, - timezone: '+05:30', action: { params: { values: { @@ -85,6 +84,7 @@ describe('formatter', () => { }, }, }, + get: () => '+05:30', } as any; const queryParser = createQueryParser(db); await compose([parseFieldAndAssociations, queryParser.parse(), queryData])(ctx, async () => {}); @@ -112,7 +112,7 @@ describe('formatter', () => { const ctx = { app, db, - timezone: '+05:30', + get: () => '+05:30', action: { params: { values: { @@ -153,7 +153,7 @@ describe('formatter', () => { const ctx = { app, db, - timezone: '+05:30', + get: () => '+05:30', action: { params: { values: { @@ -202,7 +202,7 @@ describe('formatter', () => { const ctx = { app, db, - timezone: '+05:30', + get: () => '+05:30', action: { params: { values: { @@ -250,7 +250,7 @@ describe('formatter', () => { const ctx = { app, db, - timezone: '+05:30', + get: () => '+05:30', action: { params: { values: { diff --git a/packages/plugins/@nocobase/plugin-data-visualization/src/server/query-parser/query-parser.ts b/packages/plugins/@nocobase/plugin-data-visualization/src/server/query-parser/query-parser.ts index a593591b7..82144c16f 100644 --- a/packages/plugins/@nocobase/plugin-data-visualization/src/server/query-parser/query-parser.ts +++ b/packages/plugins/@nocobase/plugin-data-visualization/src/server/query-parser/query-parser.ts @@ -97,7 +97,7 @@ export class QueryParser { attributes: dimensionAttributes, group, fieldMap: dimensionFieldMap, - } = this.parseDimensions(ctx, dimensions, hasAgg, ctx.timezone); + } = this.parseDimensions(ctx, dimensions, hasAgg, ctx.get?.('x-timezone')); const order = this.parseOrders(ctx, orders, hasAgg); ctx.action.params.values = {