From 852ec8dfed75add1b54dc921c19899628a2c30ec Mon Sep 17 00:00:00 2001 From: Sarah Zakarias Date: Mon, 11 Nov 2024 10:13:50 +0000 Subject: [PATCH] Fix text showing date interval for weekly downloads --- pkg/web_app/lib/src/widget/weekly_sparkline/widget.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pkg/web_app/lib/src/widget/weekly_sparkline/widget.dart b/pkg/web_app/lib/src/widget/weekly_sparkline/widget.dart index b326383550..62cc2bafff 100644 --- a/pkg/web_app/lib/src/widget/weekly_sparkline/widget.dart +++ b/pkg/web_app/lib/src/widget/weekly_sparkline/widget.dart @@ -25,7 +25,6 @@ void create(HTMLElement element, Map options) { final decoded = decodeIntsFromLittleEndianBase64String(dataPoints); final newestDate = DateTime.fromMillisecondsSinceEpoch(decoded[0] * 1000); final weeklyDownloads = decoded.sublist(1); - // TODO(https://github.com/dart-lang/pub-dev/issues/8251): Update this to 52. final dataListLength = weeklyDownloads.length > 40 ? 40 : weeklyDownloads.length; @@ -149,9 +148,9 @@ void drawChart(Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText, toolTip.text = '${selectedDay.downloads}'; - final endDate = selectedDay.date.add(Duration(days: 7)); + final startDate = selectedDay.date.subtract(Duration(days: 7)); chartSubText.text = - ' ${formatDate(selectedDay.date)} - ${formatDate(endDate)}'; + '${formatDate(startDate)} - ${formatDate(selectedDay.date)}'; lastSelectedDay = selectedDay.date; });