From 21c035b8d56361eb170a3cba9deef9fc3985baff Mon Sep 17 00:00:00 2001 From: ilkin-overleaf <100852799+ilkin-overleaf@users.noreply.github.com> Date: Tue, 13 May 2025 13:05:26 +0300 Subject: [PATCH] Merge pull request #25468 from overleaf/ii-flexible-licensing-invoice-date [web] FL next invoice date formatting GitOrigin-RevId: 5f4f86d4f11c7ee217ff806d26fc3f8a79e5affc --- .../components/add-seats/cost-summary.tsx | 3 ++- .../upgrade-subscription-upgrade-summary.tsx | 6 +++++- services/web/frontend/js/features/utils/format-date.ts | 9 +++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/services/web/frontend/js/features/group-management/components/add-seats/cost-summary.tsx b/services/web/frontend/js/features/group-management/components/add-seats/cost-summary.tsx index 812faabbea..d13c543852 100644 --- a/services/web/frontend/js/features/group-management/components/add-seats/cost-summary.tsx +++ b/services/web/frontend/js/features/group-management/components/add-seats/cost-summary.tsx @@ -156,7 +156,8 @@ function CostSummary({ subscriptionChange, totalLicenses }: CostSummaryProps) { ), date: formatTime( subscriptionChange.nextInvoice.date, - 'MMMM D' + 'MMMM D', + true ), } )} diff --git a/services/web/frontend/js/features/group-management/components/upgrade-subscription/upgrade-subscription-upgrade-summary.tsx b/services/web/frontend/js/features/group-management/components/upgrade-subscription/upgrade-subscription-upgrade-summary.tsx index d7546ccfa7..23cb76a294 100644 --- a/services/web/frontend/js/features/group-management/components/upgrade-subscription/upgrade-subscription-upgrade-summary.tsx +++ b/services/web/frontend/js/features/group-management/components/upgrade-subscription/upgrade-subscription-upgrade-summary.tsx @@ -100,7 +100,11 @@ function UpgradeSummary({ subscriptionChange }: UpgradeSummaryProps) { subscriptionChange.nextInvoice.tax.amount, subscriptionChange.currency ), - date: formatTime(subscriptionChange.nextInvoice.date, 'MMMM D'), + date: formatTime( + subscriptionChange.nextInvoice.date, + 'MMMM D', + true + ), } )} {subscriptionChange.immediateCharge.discount !== 0 && diff --git a/services/web/frontend/js/features/utils/format-date.ts b/services/web/frontend/js/features/utils/format-date.ts index 5210bf6962..d347c832b0 100644 --- a/services/web/frontend/js/features/utils/format-date.ts +++ b/services/web/frontend/js/features/utils/format-date.ts @@ -11,8 +11,13 @@ moment.updateLocale('en', { }, }) -export function formatTime(date: moment.MomentInput, format = 'h:mm a') { - return moment(date).format(format) +export function formatTime( + date: moment.MomentInput, + format = 'h:mm a', + utc = false +) { + const momentDate = utc ? moment.utc(date) : moment(date) + return momentDate.format(format) } export function relativeDate(date: moment.MomentInput) {