Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix isValidTimezone returning false positives when empty string provided

Blue Mouseb7a38fe66728
diff --git a/src/analytics/analytics.service.ts b/src/analytics/analytics.service.ts
index 7d1728626..36ce484a9 100644
--- a/src/analytics/analytics.service.ts
+++ b/src/analytics/analytics.service.ts
@@ -62,6 +62,10 @@ const customEVvalidate = /^[a-zA-Z](?:[\w\.]){0,62}$/
interface GetFiltersQuery extends Array<string | object>{0:string; 1:object}
const isValidTimezone = (timezone) => {
+ if (_isEmpty(timezone)) {
+ return false
+ }
+
try {
dayjs.tz('2013-11-18 11:55', timezone)
return true
@@ -416,7 +420,6 @@ export class AnalyticsService {
}
}
- // todo: winter / summer time does not seem to work here..
if (timezone !== DEFAULT_TIMEZONE && isValidTimezone(timezone)) {
x = _map(x, el => dayjs.utc(el).tz(timezone).format('YYYY-MM-DD HH:mm:ss'))
}