Add caching to the web app to reduce requests for the same data

This commit is contained in:
Henry Dollman
2024-10-10 18:11:36 -04:00
parent cedf80a869
commit 4245da7792
2 changed files with 30 additions and 8 deletions

View File

@@ -136,8 +136,8 @@ export function updateRecordList<T extends RecordModel>(
$store.set(newRecords)
}
export function getPbTimestamp(timeString: ChartTimes) {
const d = chartTimeData[timeString].getOffset(new Date())
export function getPbTimestamp(timeString: ChartTimes, d?: Date) {
d ||= chartTimeData[timeString].getOffset(new Date())
const year = d.getUTCFullYear()
const month = String(d.getUTCMonth() + 1).padStart(2, '0')
const day = String(d.getUTCDate()).padStart(2, '0')