Fix date formatting in system graphs

This commit is contained in:
Girish Ramakrishnan
2025-10-03 18:38:09 +02:00
parent b20107ad2a
commit dfb465ef77
4 changed files with 16 additions and 17 deletions

View File

@@ -1,7 +1,6 @@
<script setup>
import moment from 'moment-timezone';
import { onMounted, onUnmounted, useTemplateRef, watch } from 'vue';
import Chart from 'chart.js/auto';
import { prettyDecimalSize, formatDate } from '@cloudron/pankow/utils';
@@ -144,7 +143,7 @@ function createGraphOptions({ yscale, period, highMark }) {
maxRotation: 0, // don't rotate the labels
callback: function (value) {
if (period.hours === 0) return `${5-(value-this.min)/60000}min`;
return moment(value).format(period.tickFormat);
return formatDate(period.tickFormat, value);
},
count, // ignored when stepSize is set
stepSize // for realtime graph, generate steps of 1min and appropriate tick text