Keep adoption transfer codes stable
This commit is contained in:
@@ -154,8 +154,12 @@ const drawSimpleWeightChart = (doc: PDFKit.PDFDocument, weights: WeightRow[], bi
|
||||
}
|
||||
|
||||
const latestDate = new Date(`${plottedWeights[plottedWeights.length - 1].recorded_on.slice(0, 10)}T00:00:00Z`);
|
||||
const earliestDate = new Date(`${plottedWeights[0].recorded_on.slice(0, 10)}T00:00:00Z`);
|
||||
const startDate = new Date(latestDate);
|
||||
startDate.setUTCDate(startDate.getUTCDate() - 29);
|
||||
startDate.setUTCDate(startDate.getUTCDate() - 13);
|
||||
if (earliestDate > startDate) {
|
||||
startDate.setTime(earliestDate.getTime());
|
||||
}
|
||||
const visibleWeights = plottedWeights.filter((entry) => {
|
||||
const recordedOn = new Date(`${entry.recorded_on.slice(0, 10)}T00:00:00Z`);
|
||||
return recordedOn >= startDate && recordedOn <= latestDate;
|
||||
|
||||
Reference in New Issue
Block a user