From c6eec3ee62b8d24335ec176a7a3ee43a6a91c41e Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Tue, 22 Sep 2020 18:35:11 -0700 Subject: [PATCH 1/3] Include credentials in fetch. --- lib/web.js | 1 + package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/web.js b/lib/web.js index 4081b3ab..82c1e75b 100644 --- a/lib/web.js +++ b/lib/web.js @@ -2,6 +2,7 @@ export const apiRequest = (method, url, body) => fetch(url, { method, cache: 'no-cache', + credentials: 'same-origin', headers: { Accept: 'application/json', 'Content-Type': 'application/json', diff --git a/package.json b/package.json index 543e201b..639a5bc5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "umami", - "version": "0.49.0", + "version": "0.50.0", "description": "A simple, fast, website analytics alternative to Google Analytics. ", "author": "Mike Cao ", "license": "MIT", From 15ea2ba913cd2c638a7b50fa81f590bc56d5d5fc Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Wed, 23 Sep 2020 08:22:40 -0700 Subject: [PATCH 2/3] Fix date issue in Safari. --- lib/date.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/date.js b/lib/date.js index 63bad45e..cdfe322c 100644 --- a/lib/date.js +++ b/lib/date.js @@ -100,6 +100,19 @@ export function getDateRangeValues(startDate, endDate) { return { startDate: startOfDay(startDate), endDate: endOfDay(endDate), unit }; } +export function getDateFromString(str) { + const [ymd, hms] = str.split(' '); + const [year, month, day] = ymd.split('-'); + + if (hms) { + const [hour, min, sec] = hms.split(':'); + + return new Date(year, month - 1, day, hour, min, sec); + } + + return new Date(year, month - 1, day); +} + const dateFuncs = { hour: [differenceInHours, addHours, startOfHour], day: [differenceInCalendarDays, addDays, startOfDay], @@ -114,12 +127,7 @@ export function getDateArray(data, startDate, endDate, unit) { function findData(t) { const x = data.find(e => { - if (unit === 'hour') { - return normalize(new Date(e.t)).getTime() === t.getTime(); - } - - const [year, month, day] = e.t.split('-'); - return normalize(new Date(year, month - 1, day)).getTime() === t.getTime(); + return normalize(getDateFromString(e.t)).getTime() === t.getTime(); }); return x?.y || 0; From a56738597de98e7149cdc7ae5a5288724c3d5008 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Wed, 23 Sep 2020 15:41:56 -0700 Subject: [PATCH 3/3] Always show More button. Update page filter. --- components/metrics/MetricsTable.js | 2 +- lib/filters.js | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/components/metrics/MetricsTable.js b/components/metrics/MetricsTable.js index eca58dc2..75fd579c 100644 --- a/components/metrics/MetricsTable.js +++ b/components/metrics/MetricsTable.js @@ -99,7 +99,7 @@ export default function MetricsTable({ )}
- {limit && data.length > limit && ( + {limit && (