Skip to content

Commit ba5f72e

Browse files
authored
Fix text showing date interval for weekly downloads (#8265)
1 parent a25c803 commit ba5f72e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

pkg/web_app/lib/src/widget/weekly_sparkline/widget.dart

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ void create(HTMLElement element, Map<String, String> options) {
2525
final decoded = decodeIntsFromLittleEndianBase64String(dataPoints);
2626
final newestDate = DateTime.fromMillisecondsSinceEpoch(decoded[0] * 1000);
2727
final weeklyDownloads = decoded.sublist(1);
28-
2928
// TODO(https://github.com/dart-lang/pub-dev/issues/8251): Update this to 52.
3029
final dataListLength =
3130
weeklyDownloads.length > 40 ? 40 : weeklyDownloads.length;
@@ -149,9 +148,9 @@ void drawChart(Element svg, HTMLDivElement toolTip, HTMLDivElement chartSubText,
149148

150149
toolTip.text = '${selectedDay.downloads}';
151150

152-
final endDate = selectedDay.date.add(Duration(days: 7));
151+
final startDate = selectedDay.date.subtract(Duration(days: 7));
153152
chartSubText.text =
154-
' ${formatDate(selectedDay.date)} - ${formatDate(endDate)}';
153+
'${formatDate(startDate)} - ${formatDate(selectedDay.date)}';
155154

156155
lastSelectedDay = selectedDay.date;
157156
});

0 commit comments

Comments
 (0)