Skip to content

Commit

Permalink
[Limit Orders]: Fix date display for order history (#3833)
Browse files Browse the repository at this point in the history
* fix: date display for order history

* fix: undid feature flag changes

* fix: typing issue
  • Loading branch information
crnbarr93 committed Sep 10, 2024
1 parent d1af6ad commit 8f3e076
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ async function getTickInfoAndTransformOrders(
output,
quoteAsset,
baseAsset,
placed_at: dayjs(parseInt(o.placed_at) / 1_000).unix(),
placed_at: dayjs(o.placed_at / 1000).unix(),
};
});
}
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

0 comments on commit 8f3e076

Please sign in to comment.