File tree Expand file tree Collapse file tree 2 files changed +5
-7
lines changed
packages/cubejs-schema-compiler/src/adapter Expand file tree Collapse file tree 2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -249,17 +249,15 @@ export class BaseTimeDimension extends BaseFilter {
249249 return this . dateRangeGranularity ( ) ;
250250 }
251251
252- if ( ! this . dateRange ) {
253- return this . granularityObj . minGranularity ( ) ;
254- }
255-
256252 // If we have granularity and date range, we need to check
257253 // that the interval and the granularity offset are stacked/fits with date range
258- if ( this . granularityObj . isPredefined ( ) ||
259- ! this . granularityObj . isAlignedWithDateRange ( [ this . dateFromFormatted ( ) , this . dateToFormatted ( ) ] ) ) {
254+ if ( this . dateRange && ( this . granularityObj . isPredefined ( ) ||
255+ ! this . granularityObj . isAlignedWithDateRange ( [ this . dateFromFormatted ( ) , this . dateToFormatted ( ) ] ) ) ) {
260256 return this . query . minGranularity ( this . granularityObj . minGranularity ( ) , this . dateRangeGranularity ( ) ) ;
261257 }
262258
259+ // We return the granularity as-is, including custom ones,
260+ // because baseQuery.granularityHierarchies correctly expands all custom granularities into hierarchies.
263261 return this . granularityObj . granularity ;
264262 }
265263 ) ;
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export class Granularity {
3131 ) {
3232 this . granularity = timeDimension . granularity ;
3333 this . predefinedGranularity = isPredefinedGranularity ( this . granularity ) ;
34- this . queryTimezone = query . timezone ;
34+ this . queryTimezone = query . timezone || 'UTC' ;
3535 this . origin = moment . tz ( query . timezone ) . startOf ( 'year' ) ; // Defaults to current year start
3636
3737 if ( this . predefinedGranularity ) {
You can’t perform that action at this time.
0 commit comments