Skip to content

Commit

Permalink
[SDP-1138]: Add seconds to payment history in Payment Details (#87)
Browse files Browse the repository at this point in the history
  • Loading branch information
ceciliaromao authored Apr 2, 2024
1 parent 278767f commit b97343e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
14 changes: 14 additions & 0 deletions src/helpers/formatIntlDateTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,17 @@ export const formatDateTime = (dateTime?: string) => {

return dateTimeFormatter.format(date);
};

export const formatDateTimeWithSeconds = (dateTime?: string) => {
const date = dateTime ? new Date(dateTime) : new Date();
const dateTimeFormatter = new Intl.DateTimeFormat("en-US", {
month: "short",
day: "numeric",
year: "numeric",
hour: "numeric",
minute: "2-digit",
second: "2-digit",
});

return dateTimeFormatter.format(date);
};
11 changes: 8 additions & 3 deletions src/pages/PaymentDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ import {
CANCELED_PAYMENT_STATUS,
READY_PAYMENT_STATUS,
} from "constants/settings";
import { formatDateTime } from "helpers/formatIntlDateTime";
import {
formatDateTime,
formatDateTimeWithSeconds,
} from "helpers/formatIntlDateTime";
import { shortenString } from "helpers/shortenString";
import { formatPaymentDetails } from "helpers/formatPaymentDetails";

Expand Down Expand Up @@ -179,7 +182,9 @@ export const PaymentDetails = () => {
<div className="PaymentDetails__wrapper">
<div className="PaymentDetails__info">
<label className="Label">Created at</label>
<div>{formatDateTime(formattedPayment.createdAt)}</div>
<div>
{formatDateTimeWithSeconds(formattedPayment.createdAt)}
</div>
</div>

<div className="PaymentDetails__info">
Expand Down Expand Up @@ -297,7 +302,7 @@ export const PaymentDetails = () => {
</Table.BodyCell>
<Table.BodyCell textAlign="right">
<span className="Table-v2__cell--secondary">
{formatDateTime(h.updatedAt)}
{formatDateTimeWithSeconds(h.updatedAt)}
</span>
</Table.BodyCell>
</Table.BodyRow>
Expand Down

0 comments on commit b97343e

Please sign in to comment.