mirror of
https://github.com/umami-software/umami.git
synced 2025-12-08 05:12:36 +01:00
Revert "fix "Last X unit" minDate cutoff"
This reverts commit 55c8a6f7cc.
This commit is contained in:
parent
8e05921227
commit
a8b4ddd054
1 changed files with 7 additions and 3 deletions
|
|
@ -122,9 +122,8 @@ export function parseDateValue(value: string) {
|
||||||
if (!match) return null;
|
if (!match) return null;
|
||||||
|
|
||||||
const { num, unit } = match.groups;
|
const { num, unit } = match.groups;
|
||||||
const formattedNum = +num > 0 ? +num - 1 : +num;
|
|
||||||
|
|
||||||
return { num: formattedNum, unit };
|
return { num: +num, unit };
|
||||||
}
|
}
|
||||||
|
|
||||||
export function parseDateRange(value: string, locale = 'en-US'): DateRange {
|
export function parseDateRange(value: string, locale = 'en-US'): DateRange {
|
||||||
|
|
@ -158,7 +157,12 @@ export function parseDateRange(value: string, locale = 'en-US'): DateRange {
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const dateLocale = getDateLocale(locale);
|
const dateLocale = getDateLocale(locale);
|
||||||
const { num = 1, unit } = parseDateValue(value);
|
const { unit } = parseDateValue(value);
|
||||||
|
let { num = 1 } = parseDateValue(value);
|
||||||
|
|
||||||
|
if (value === '7day') {
|
||||||
|
num--;
|
||||||
|
}
|
||||||
|
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
case 'hour':
|
case 'hour':
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue