diff --git a/libs/market-info/src/components/market-expires/market-expires.spec.tsx b/libs/market-info/src/components/market-expires/market-expires.spec.tsx
index 48071033f..b06f7f397 100644
--- a/libs/market-info/src/components/market-expires/market-expires.spec.tsx
+++ b/libs/market-info/src/components/market-expires/market-expires.spec.tsx
@@ -1,5 +1,6 @@
-import React from 'react';
import { render, screen } from '@testing-library/react';
+import React from 'react';
+
import { MarketExpires } from './market-expires';
describe('MarketExpires', () => {
@@ -13,7 +14,7 @@ describe('MarketExpires', () => {
'settlement:20220525T1200',
];
render();
- expect(screen.getByText('May 25')).toBeInTheDocument();
+ expect(screen.getByText('25/05/2022, 12:00:00')).toBeInTheDocument();
});
it('settlement-date:date', () => {
@@ -23,7 +24,7 @@ describe('MarketExpires', () => {
'settlement-date:2022-04-25T1200',
];
render();
- expect(screen.getByText('Apr 25')).toBeInTheDocument();
+ expect(screen.getByText('25/04/2022, 12:00:00')).toBeInTheDocument();
});
it('last one proper tag should matter', () => {
@@ -33,7 +34,7 @@ describe('MarketExpires', () => {
'settlement-expiry-date:2022-03-25T12:00:00',
];
render();
- expect(screen.getByText('Mar 25')).toBeInTheDocument();
+ expect(screen.getByText('25/03/2022, 12:00:00')).toBeInTheDocument();
});
it('when no proper tag nor date should be null', () => {
diff --git a/libs/market-info/src/components/market-expires/market-expires.tsx b/libs/market-info/src/components/market-expires/market-expires.tsx
index 1989b0217..ee4daa134 100644
--- a/libs/market-info/src/components/market-expires/market-expires.tsx
+++ b/libs/market-info/src/components/market-expires/market-expires.tsx
@@ -1,8 +1,7 @@
-import type { SingleMarketFieldsFragment } from '@vegaprotocol/market-list';
-import { getDateFormat, t } from '@vegaprotocol/react-helpers';
-import { format, isValid, parseISO } from 'date-fns';
+import { getDateTimeFormat, t } from '@vegaprotocol/react-helpers';
+import { isValid, parseISO } from 'date-fns';
-export const EXPIRE_DATE_FORMAT = 'MMM dd';
+import type { SingleMarketFieldsFragment } from '@vegaprotocol/market-list';
export const getMarketExpiryDate = (
tags?: ReadonlyArray | null
@@ -31,7 +30,7 @@ export const getMarketExpiryDateFormatted = (
): string | null => {
if (tags) {
const dateFound = getMarketExpiryDate(tags);
- return dateFound ? format(dateFound, EXPIRE_DATE_FORMAT) : null;
+ return dateFound ? getDateTimeFormat().format(dateFound) : null;
}
return null;
};
@@ -45,14 +44,14 @@ export const getExpiryDate = (market: SingleMarketFieldsFragment): string => {
let content = null;
if (!closeDate) {
content = closedMarketDate
- ? `Expired on ${getDateFormat().format(closedMarketDate)}`
+ ? `Expired on ${getDateTimeFormat().format(closedMarketDate)}`
: t('Not time-based');
} else {
const isExpired = Date.now() - closeDate.valueOf() > 0;
- const expiryDate = getDateFormat().format(closeDate);
+ const expiryDate = getDateTimeFormat().format(closeDate);
if (isExpired) {
content = closedMarketDate
- ? `Expired on ${getDateFormat().format(closedMarketDate)}`
+ ? `Expired on ${getDateTimeFormat().format(closedMarketDate)}`
: t('Expired');
} else {
content = expiryDate;