fix hitung ayam dan karung data yang ditampilkan melebihi estimasi panen
CI / lint-and-test (push) Canceled after 0s
CI / lint-and-test (push) Canceled after 0s
This commit is contained in:
1 parent
32a36cceff
commit
b6117ae7d5
8 files changed
+105
-49
No files matched your search
@@ -30,8 +30,9 @@ const FeedTrendChart: React.FC<FeedTrendChartProps> = ({
|
||||
const cycleStart = new Date(cycleStartDate);
|
||||
cycleStart.setHours(0, 0, 0, 0);
|
||||
|
||||
const now = new Date();
|
||||
now.setHours(0, 0, 0, 0);
|
||||
const cycleEnd = new Date(cycleStart);
|
||||
cycleEnd.setDate(cycleStart.getDate() + currentDay);
|
||||
cycleEnd.setHours(23, 59, 59, 999);
|
||||
|
||||
// Initialize daily buckets
|
||||
const dailyData: { [key: number]: Record<string, any> } = {};
|
||||
@@ -49,7 +50,7 @@ const FeedTrendChart: React.FC<FeedTrendChartProps> = ({
|
||||
|
||||
// Aggregate data by day
|
||||
data.forEach((log) => {
|
||||
if (log.timestamp >= cycleStart && log.timestamp <= now) {
|
||||
if (log.timestamp >= cycleStart && log.timestamp <= cycleEnd) {
|
||||
const diffTime = log.timestamp.getTime() - cycleStart.getTime();
|
||||
const dayNumber = Math.floor(diffTime / (1000 * 60 * 60 * 24));
|
||||
|
||||
|
||||
Reference in new issue
Block a user