Skip to content

Commit

Permalink
fix manage land expiration date
Browse files Browse the repository at this point in the history
  • Loading branch information
Melisa Anabella Rossi committed Oct 31, 2023
1 parent 049b7e8 commit 0570d0f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
5 changes: 4 additions & 1 deletion webapp/src/components/ManageAssetPage/Sell/Sell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ const Sell = (props: Props) => {
{t('manage_asset_page.sell.expiration_date')}
</div>
<div className={styles.columnContent}>
{intlFormat(order.expiresAt)}
{intlFormat(
order.expiresAt *
(order.expiresAt.toString().length === 10 ? 1000 : 1)
)}
</div>
</div>
</div>
Expand Down
21 changes: 16 additions & 5 deletions webapp/src/components/Modals/SellModal/SellModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,22 @@ const SellModal = ({
isUpdate ? ethers.utils.formatEther(order!.price) : ''
)

const [expiresAt, setExpiresAt] = useState(
isUpdate && order!.expiresAt && isValid(order!.expiresAt)
? formatDate(addDays(order!.expiresAt, 1), INPUT_FORMAT)
: getDefaultExpirationDate()
)
const [expiresAt, setExpiresAt] = useState(() => {
let exp = order?.expiresAt

if (isUpdate && exp) {
// If the order's expiration is in seconds, convert it to milliseconds
if (exp.toString().length === 10) {
exp = exp * 1000
}

if (isValid(exp)) {
return formatDate(addDays(exp, 1), INPUT_FORMAT)
}
}

return getDefaultExpirationDate()
})

const parsedValueToConfirm = parseFloat(price).toString()

Expand Down

0 comments on commit 0570d0f

Please sign in to comment.