The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(billing): stop writing a raw ISO timestamp into a credit grant's reason (#25699)
Félix Malfait1ceb09b5e655
diff --git a/packages/twenty-server/src/engine/core-modules/billing/services/billing-credit-rollover.service.ts b/packages/twenty-server/src/engine/core-modules/billing/services/billing-credit-rollover.service.tsindex 1e27bee6cc2..6f830121029 100644--- a/packages/twenty-server/src/engine/core-modules/billing/services/billing-credit-rollover.service.ts+++ b/packages/twenty-server/src/engine/core-modules/billing/services/billing-credit-rollover.service.ts@@ -1,6 +1,8 @@/* @license Enterprise */import { Injectable } from '@nestjs/common';++import { i18n } from '@lingui/core';import { InjectDataSource } from '@nestjs/typeorm';import { isDefined } from 'twenty-shared/utils';@@ -169,7 +171,13 @@ export class BillingCreditRolloverService {// every balance depend on the next transition running, which is the// failure this settlement exists to survive.expiresAt: carryForwardGrant.expiresAt,- reason: `Carried over from the period starting ${closingPeriodStart.toISOString()}`,+ // Pinned to UTC: Stripe's boundaries are UTC instants, and a+ // midnight boundary rendered in the server's local zone dates to the+ // previous day.+ reason: `Carried over from the period starting ${i18n.date(+ closingPeriodStart,+ { day: 'numeric', month: 'long', year: 'numeric', timeZone: 'UTC' },+ )}`,idempotencyKey: buildCarryForwardIdempotencyKey({workspaceId,nextPeriodStart,