mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
[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:
@@ -1,4 +1,6 @@
|
||||
export default function isInFreeTrial(trialEndsAt?: string | null) {
|
||||
export default function isInFreeTrial(
|
||||
trialEndsAt?: string | null
|
||||
): trialEndsAt is string {
|
||||
if (!trialEndsAt) return false
|
||||
|
||||
const endDate = new Date(trialEndsAt)
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { formatTime } from '@/features/utils/format-date'
|
||||
|
||||
export function formatPaymentDate(date: string | null | undefined) {
|
||||
if (!date) {
|
||||
return null
|
||||
}
|
||||
return formatTime(date, 'MMMM Do, YYYY', true)
|
||||
}
|
||||
|
||||
export function formatPaymentDateTime(date: string | null | undefined) {
|
||||
if (!date) {
|
||||
return null
|
||||
}
|
||||
return formatTime(date, 'MMMM Do, YYYY h:mm A [UTC]', true)
|
||||
}
|
||||
Reference in New Issue
Block a user