@lightdash/common 0.1423.1 → 0.1424.0
Sign up to get free protection for your applications and to get access to all the features.
@@ -30,8 +30,8 @@ export declare const getMetricExplorerDataPointsWithCompare: (dimension: Dimensi
|
|
30
30
|
};
|
31
31
|
/**
|
32
32
|
* Get the date range for a given time interval, based on the current date and the time interval
|
33
|
-
* Time grain Year: ->
|
34
|
-
* Time grain Month -> past
|
33
|
+
* Time grain Year: -> this year (i.e. start of this year until now)
|
34
|
+
* Time grain Month -> past 3 months (i.e. 3 completed months + this uncompleted month)
|
35
35
|
* Time grain Week -> past 12 weeks (i.e. 12 completed weeks + this uncompleted week)
|
36
36
|
* Time grain Day -> past 30 days (i.e. 30 completed days + this uncompleted day)
|
37
37
|
* @param timeInterval - The time interval
|
@@ -259,8 +259,8 @@ const getMetricExplorerDataPointsWithCompare = (dimension, compareDimension, met
|
|
259
259
|
exports.getMetricExplorerDataPointsWithCompare = getMetricExplorerDataPointsWithCompare;
|
260
260
|
/**
|
261
261
|
* Get the date range for a given time interval, based on the current date and the time interval
|
262
|
-
* Time grain Year: ->
|
263
|
-
* Time grain Month -> past
|
262
|
+
* Time grain Year: -> this year (i.e. start of this year until now)
|
263
|
+
* Time grain Month -> past 3 months (i.e. 3 completed months + this uncompleted month)
|
264
264
|
* Time grain Week -> past 12 weeks (i.e. 12 completed weeks + this uncompleted week)
|
265
265
|
* Time grain Day -> past 30 days (i.e. 30 completed days + this uncompleted day)
|
266
266
|
* @param timeInterval - The time interval
|
@@ -271,24 +271,21 @@ const getDefaultDateRangeFromInterval = (timeInterval) => {
|
|
271
271
|
switch (timeInterval) {
|
272
272
|
case timeFrames_1.TimeFrames.DAY:
|
273
273
|
return [
|
274
|
-
now.subtract(
|
274
|
+
now.subtract(30, 'day').startOf('day').toDate(),
|
275
275
|
now.toDate(),
|
276
276
|
];
|
277
277
|
case timeFrames_1.TimeFrames.WEEK:
|
278
278
|
return [
|
279
|
-
now.subtract(
|
279
|
+
now.subtract(12, 'week').startOf('isoWeek').toDate(),
|
280
280
|
now.toDate(),
|
281
281
|
];
|
282
282
|
case timeFrames_1.TimeFrames.MONTH:
|
283
283
|
return [
|
284
|
-
now.subtract(
|
284
|
+
now.subtract(3, 'month').startOf('month').toDate(),
|
285
285
|
now.toDate(),
|
286
286
|
];
|
287
287
|
case timeFrames_1.TimeFrames.YEAR:
|
288
|
-
return [
|
289
|
-
now.subtract(4, 'year').startOf('year').toDate(),
|
290
|
-
now.toDate(),
|
291
|
-
];
|
288
|
+
return [now.startOf('year').toDate(), now.toDate()];
|
292
289
|
default:
|
293
290
|
return (0, exports.assertUnimplementedTimeframe)(timeInterval);
|
294
291
|
}
|