[web] Remove SubscriptionFormatters, format subscription dates in the frontend (#36409)

* [web] Remove SubscriptionFormatters, format subscription dates in the frontend

Replace the server-formatted nextPaymentDueAt/nextPaymentDueDate/
trialEndsAtFormatted fields with the raw periodEnd date and format in
the React dashboard (same strings as before, English + UTC). Also
consolidate hand-rolled trial checks onto isInFreeTrial /
SubscriptionHelper.isInTrial.

* [web] Remove the now-unused dateformat dependency

* [web] Address review: payment-dates unit test, UTC dates in acceptance test

Add a dedicated unit test asserting the exact formatted strings from
formatPaymentDate/formatPaymentDateTime, and use explicit UTC timestamps
in the SubscriptionDashboard acceptance fixtures instead of
local-timezone Date constructors.

GitOrigin-RevId: 16ac4f1098b14ef9f1478d22cf39c1357ead7dea
This commit is contained in:
Antoine Clausse
2026-09-17 11:52:44 +00:00
committed by Copybot
parent d0399bd09f
commit ba4f024f34
26 changed files with 149 additions and 203 deletions
@@ -33,6 +33,7 @@ import { formatCurrency } from '@/shared/utils/currency'
import { ManagedInstitution } from '../../../../../types/subscription/dashboard/managed-institution'
import { Publisher } from '../../../../../types/subscription/dashboard/publisher'
import { formatTime } from '@/features/utils/format-date'
import { formatPaymentDateTime } from '../util/payment-dates'
type SubscriptionDashboardContextValue = {
groupPlanToChangeToCode: string
@@ -150,7 +151,7 @@ export function SubscriptionDashboardProvider({
!personalSubscription.payment.pausedAt ||
!personalSubscription.payment.remainingPauseCycles
) {
return personalSubscription.payment.nextPaymentDueAt
return formatPaymentDateTime(personalSubscription.payment.periodEnd)!
}
const pausedDate = new Date(personalSubscription.payment.pausedAt)
pausedDate.setMonth(