Fix refresh button issue, closes #840

This commit is contained in:
Mike Cao 2021-12-19 22:49:08 -08:00
parent 7b7557ec90
commit 504b5f10d9
3 changed files with 6 additions and 7 deletions

View file

@ -39,7 +39,11 @@ export function getDateRange(value, locale = 'en-US') {
const now = new Date();
const dateLocale = getDateLocale(locale);
const { num, unit } = value.match(/^(?<num>[0-9]+)(?<unit>hour|day|week|month|year)$/).groups;
const match = value.match(/^(?<num>[0-9]+)(?<unit>hour|day|week|month|year)$/);
if (!match) return;
const { num, unit } = match.groups;
if (+num === 1) {
switch (unit) {