Skip to content

Commit

Permalink
fix: date display for order history
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Sep 8, 2024
1 parent 9f33e44 commit b563cf5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,11 @@ async function mapHistoricalToMapped(
order_direction: o.order_direction,
order_id: parseInt(o.order_id),
owner: userAddress,
placed_at:
dayjs(
o.place_timestamp && o.place_timestamp.length > 0
? o.place_timestamp
: 0
).unix() * 1000,
placed_at: dayjs(
o.place_timestamp && o.place_timestamp.length > 0
? o.place_timestamp
: 0
).unix(),
placed_quantity: parseInt(o.quantity),
placedQuantityMin,
quantityMin,
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/queries/osmosis/orderbooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export interface LimitOrder {
etas: string;
claim_bounty?: string;
placed_quantity: string;
placed_at: string;
placed_at: number;
}

interface OrderbookActiveOrdersResponse {
Expand Down
2 changes: 1 addition & 1 deletion packages/web/components/complex/orders-history/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ const TableOrderRow = memo(
baseAsset?.rawAsset.logoURIs.png ??
"";

const placedAt = dayjs(placed_at);
const placedAt = dayjs.unix(placed_at);
const formattedTime = placedAt.format("h:mm A");
const formattedDate = placedAt.format("MMM D");

Expand Down
11 changes: 7 additions & 4 deletions packages/web/components/complex/orders-history/order-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,14 @@ const OrderDetails = observer(
: order.baseAsset;
}, [order]);

const formattedMonth = dayjs(order?.placed_at).format("MMMM").slice(0, 3);
const formattedMonth = dayjs
.unix(order?.placed_at ?? 0)
.format("MMMM")
.slice(0, 3);

const formattedDateDayYearHourMinute = dayjs(order?.placed_at).format(
"DD, YYYY, HH:mm"
);
const formattedDateDayYearHourMinute = dayjs
.unix(order?.placed_at ?? 0)
.format("DD, YYYY, HH:mm");

const formattedDate = `${formattedMonth} ${formattedDateDayYearHourMinute}`;

Expand Down
6 changes: 1 addition & 5 deletions packages/web/hooks/use-feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,7 @@ export function useFeatureFlags() {
launchdarklyFlags.oneClickTrading,
_isInitialized: isDevModeWithoutClientID ? true : isInitialized,
_isClientIDPresent: !!process.env.NEXT_PUBLIC_LAUNCH_DARKLY_CLIENT_SIDE_ID,
limitOrders:
isInitialized &&
launchdarklyFlags.limitOrders &&
(LIMIT_ORDER_COUNTRY_CODES.length === 0 ||
LIMIT_ORDER_COUNTRY_CODES.includes(levanaGeoblock?.countryCode ?? "")),
limitOrders: true,
} as Record<
AvailableFlags | "_isInitialized" | "_isClientIDPresent",
boolean
Expand Down

0 comments on commit b563cf5

Please sign in to comment.