Files
flutter/lib/helpers/charts.dart
Roland Geider f18af2ed65 Move milliseconds factor to a constant
This makes it less likely to run into weird bugs if we need to tweak
the value in the future.
2025-05-22 14:34:36 +02:00

10 lines
258 B
Dart

import 'consts.dart';
double chartGetInterval(DateTime first, DateTime last, {divider = 3}) {
final dayDiff = last.difference(first);
return dayDiff.inMilliseconds == 0
? CHART_MILLISECOND_FACTOR
: dayDiff.inMilliseconds.abs() / divider;
}