Merge pull request #36475 from overleaf/revert-36409-ac-remove-subscription-formatters

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

GitOrigin-RevId: d4c6bb600f7315c27016a45a8250a61b46de0119
This commit is contained in:
Antoine Clausse
2026-09-17 11:52:51 +00:00
committed by Copybot
parent c461297b13
commit 07835f92b3
26 changed files with 203 additions and 149 deletions
@@ -0,0 +1,30 @@
import { describe, expect, it } from 'vitest'
import SubscriptionFormatters from '../../../../app/src/Features/Subscription/SubscriptionFormatters.mjs'
describe('SubscriptionFormatters', function () {
describe('formatDateTime', function () {
it('should return null if no date', function () {
const result = SubscriptionFormatters.formatDateTime(null)
expect(result).to.equal(null)
})
it('should format date with time', function () {
const date = new Date(1639904485000)
const result = SubscriptionFormatters.formatDateTime(date)
expect(result).to.equal('December 19th, 2021 9:01 AM UTC')
})
})
describe('formatDate', function () {
it('should return null if no date', function () {
const result = SubscriptionFormatters.formatDate(null)
expect(result).to.equal(null)
})
it('should format date', function () {
const date = new Date(1639904485000)
const result = SubscriptionFormatters.formatDate(date)
expect(result).to.equal('December 19th, 2021')
})
})
})
@@ -745,10 +745,12 @@ describe('SubscriptionViewModelBuilder', function () {
},
],
totalLicenses: 0,
periodEnd: new Date('2025-02-20T12:00:00.000Z'),
nextPaymentDueAt: 'February 20th, 2025 12:00 PM UTC',
nextPaymentDueDate: 'February 20th, 2025',
currency: 'EUR',
planPrice: 13,
state: 'active',
trialEndsAtFormatted: null,
trialEndsAt: null,
activeCoupons: [],
accountEmail: 'example@example.com',