Merge pull request #3692 from BerriAI/ui_fix_start_end_time

[UI] End User Spend - Fix Timezone diff bug
This commit is contained in:
Ishaan Jaff 2024-05-16 13:39:01 -07:00 committed by GitHub
commit c397114591
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -675,7 +675,6 @@ export const tagsSpendLogsCall = async (
});
if (!response.ok) {
const errorData = await response.text();
message.error(errorData, 10);
throw new Error("Network response was not ok");
}

View file

@ -142,6 +142,12 @@ const UsagePage: React.FC<UsagePageProps> = ({
return;
}
// the endTime put it to the last hour of the selected date
endTime.setHours(23, 59, 59, 999);
// startTime put it to the first hour of the selected date
startTime.setHours(0, 0, 0, 0);
console.log("uiSelectedKey", uiSelectedKey);
let newTopUserData = await adminTopEndUsersCall(
@ -160,6 +166,12 @@ const UsagePage: React.FC<UsagePageProps> = ({
return;
}
// the endTime put it to the last hour of the selected date
endTime.setHours(23, 59, 59, 999);
// startTime put it to the first hour of the selected date
startTime.setHours(0, 0, 0, 0);
let top_tags = await tagsSpendLogsCall(accessToken, startTime.toISOString(), endTime.toISOString());
setTopTagsData(top_tags.spend_per_tag);
console.log("Tag spend data updated successfully");