diff --git a/apps/webapp/app/presenters/OrgUsagePresenter.server.ts b/apps/webapp/app/presenters/OrgUsagePresenter.server.ts index 364724423..6384cd871 100644 --- a/apps/webapp/app/presenters/OrgUsagePresenter.server.ts +++ b/apps/webapp/app/presenters/OrgUsagePresenter.server.ts @@ -144,6 +144,15 @@ export class OrgUsagePresenter { projectedRunCostEstimation = projectedEstimationResult?.cost.runsCost; } + const periodStart = new Date(); + periodStart.setDate(1); + periodStart.setHours(0, 0, 0, 0); + + const periodEnd = new Date(); + periodEnd.setDate(1); + periodEnd.setMonth(periodEnd.getMonth() + 1); + periodEnd.setHours(0, 0, 0, 0); + return { id: organization.id, runsCount, @@ -154,6 +163,8 @@ export class OrgUsagePresenter { hasConcurrencyData, runCostEstimation, projectedRunCostEstimation, + periodStart, + periodEnd, }; } } diff --git a/apps/webapp/app/routes/_app.orgs.$organizationSlug.billing._index/route.tsx b/apps/webapp/app/routes/_app.orgs.$organizationSlug.billing._index/route.tsx index 552d3b67a..435b81084 100644 --- a/apps/webapp/app/routes/_app.orgs.$organizationSlug.billing._index/route.tsx +++ b/apps/webapp/app/routes/_app.orgs.$organizationSlug.billing._index/route.tsx @@ -15,6 +15,7 @@ import { requireUserId } from "~/services/session.server"; import { formatCurrency, formatNumberCompact } from "~/utils/numberFormatter"; import { OrganizationParamsSchema, plansPath } from "~/utils/pathBuilder"; import { useCurrentPlan } from "../_app.orgs.$organizationSlug/route"; +import { DateTime } from "~/components/primitives/DateTime"; export async function loader({ params, request }: LoaderFunctionArgs) { const userId = await requireUserId(request); @@ -51,7 +52,7 @@ export default function Page() { const hitConcurrencyLimit = currentPlan?.subscription?.limits.concurrentRuns ? loaderData.concurrencyData.some( - (c) => c.maxConcurrentRuns >= currentPlan.subscription!.limits.concurrentRuns! + (c) => c.maxConcurrentRuns >= (currentPlan.subscription?.limits.concurrentRuns ?? Infinity) ) : false; @@ -62,7 +63,7 @@ export default function Page() { return (