Просмотр исходного кода

Merge pull request #25468 from overleaf/ii-flexible-licensing-invoice-date

[web] FL next invoice date formatting

GitOrigin-RevId: 5f4f86d4f11c7ee217ff806d26fc3f8a79e5affc
ilkin-overleaf 1 год назад
Родитель
Сommit
21c035b8d5

+ 2 - 1
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
                   ),
                 }
               )}

+ 5 - 1
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 &&

+ 7 - 2
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) {