From 5838621dd9f70af11bb8b742687b2e93f18763f0 Mon Sep 17 00:00:00 2001 From: Vasiliy Vazhesov Date: Wed, 20 Dec 2023 00:45:13 -0800 Subject: [PATCH] push --- viewer-2/pages/dashboard-stats.jsx | 61 ++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 4 deletions(-) diff --git a/viewer-2/pages/dashboard-stats.jsx b/viewer-2/pages/dashboard-stats.jsx index fabb81c..f2e1beb 100644 --- a/viewer-2/pages/dashboard-stats.jsx +++ b/viewer-2/pages/dashboard-stats.jsx @@ -4,6 +4,52 @@ import * as nextConfig from '../next.config' import * as fs from 'fs' import { Image, Container, Card, Statistic} from 'semantic-ui-react' +function toStr(date) { + const y = date.substring(0,4) + const m = date.substring(5,7) + let x + switch (m) { + case '01': + x = "Jan" + break; + case '02': + x = "Feb" + break; + case '03': + x = "Mar" + break; + case '04': + x = "Apr" + break; + case '05': + x = "May" + break; + case '06': + x = "Jun" + break; + case '07': + x = "Jul" + break; + case '08': + x = "Aug" + break; + case '09': + x = "Sep" + break; + case '10': + x = "Oct" + break; + case '11': + x = "Nov" + break; + case '12': + x = "Dec" + break; + } + + return `${x}, ${y}` +} + const IndexPage = ({yearStats, monthStats}) => { return ( @@ -14,8 +60,12 @@ const IndexPage = ({yearStats, monthStats}) => { yearStats.map(row => - - Year {row.date} + + + {row.date} + Year stats + +
@@ -45,8 +95,11 @@ const IndexPage = ({yearStats, monthStats}) => { monthStats.map(row => - - Month {row.date} + + + {toStr(row.date)} + Month stats +