Skip to content

Commit 5ef622c

Browse files
authored
Merge pull request #81 from fparrav/main
fix: improve timezone support and 30-day chart format
2 parents 5a6fb9c + f1bf912 commit 5ef622c

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

backend/Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ FROM node:20-alpine AS production
3838

3939
WORKDIR /app
4040

41+
# Install timezone data for proper TZ support
42+
RUN apk add --no-cache tzdata
43+
4144
# Create a dedicated non-root user for security
4245
RUN addgroup -g 1001 -S appgroup \
4346
&& adduser -u 1001 -S appuser -G appgroup

backend/src/server/routes/dashboard.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,12 +301,14 @@ export function dash(app: any) {
301301
: "strftime('%Y-%m-%d', datetime(created_at/1000, 'unixepoch', 'localtime'))";
302302
timeKey = "day";
303303
} else {
304-
// For longer periods, group by week (ISO week format for consistency)
304+
// For longer periods (30 days), group by day showing month-day
305305
displayFormat = is_pg
306-
? "to_char(to_timestamp(created_at/1000), 'IYYY-\"W\"IW')"
307-
: "strftime('%Y-W%W', datetime(created_at/1000, 'unixepoch', 'localtime'))";
308-
sortFormat = displayFormat;
309-
timeKey = "week";
306+
? "to_char(to_timestamp(created_at/1000), 'MM-DD')"
307+
: "strftime('%m-%d', datetime(created_at/1000, 'unixepoch', 'localtime'))";
308+
sortFormat = is_pg
309+
? "to_char(to_timestamp(created_at/1000), 'YYYY-MM-DD')"
310+
: "strftime('%Y-%m-%d', datetime(created_at/1000, 'unixepoch', 'localtime'))";
311+
timeKey = "day";
310312
}
311313

312314
const tl = await all_async(

0 commit comments

Comments
 (0)