commit 10e114124832912e72c8fe7b42b7007dc2c4ccf3
parent 9655b701ad6a2046ef83a790a7fd0446a576a2a9
Author: Sebastian <sebasjm@gmail.com>
Date: Thu, 1 Feb 2024 15:40:55 -0300
use same format to render dates
Diffstat:
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/packages/merchant-backend-ui/src/pages/ShowOrderDetails.tsx b/packages/merchant-backend-ui/src/pages/ShowOrderDetails.tsx
@@ -27,6 +27,7 @@ import "../css/pure-min.css";
import "../css/style.css";
import { MerchantBackend } from "../declaration";
import { Page, InfoBox, TableExpanded, TableSimple } from "../styled";
+import { TIME_DATE_FORMAT } from "../utils";
/**
* This page creates a payment request QR code
@@ -79,7 +80,7 @@ function Location({
location: MerchantBackend.Location | undefined;
btr?: boolean;
}) {
- //FIXME: mustache strings show be constructed in a way that ends in the final output of the html but is not present in the
+ //FIXME: mustache strings will be constructed in a way that ends in the final output of the html but is not present in the
// javascript code, otherwise when mustache render engine run over the html it will also replace string in the javascript code
// that is made to run when the browser has javascript enable leading into undefined behavior.
// that's why in the next fields we are using concatenations to build the mustache placeholder.
@@ -197,7 +198,7 @@ export function ShowOrderDetails({
? contract_terms?.timestamp.t_s != "never"
? format(
contract_terms?.timestamp.t_s * 1000,
- "dd MMM yyyy HH:mm:ss",
+ TIME_DATE_FORMAT,
)
: "never"
: `{{ contract_terms.timestamp_str }}`}{" "}
@@ -257,7 +258,7 @@ export function ShowOrderDetails({
? p.delivery_date.t_s != "never"
? format(
p.delivery_date.t_s,
- "dd MMM yyyy HH:mm:ss",
+ TIME_DATE_FORMAT,
)
: "never"
: `{{ delivery_date_str }}`}{" "}
@@ -307,7 +308,7 @@ export function ShowOrderDetails({
? contract_terms?.delivery_date.t_s != "never"
? format(
contract_terms?.delivery_date.t_s,
- "dd MMM yyyy HH:mm:ss",
+ TIME_DATE_FORMAT,
)
: "never"
: `{{ contract_terms.delivery_date_str }}`}{" "}
@@ -343,7 +344,7 @@ export function ShowOrderDetails({
? contract_terms?.wire_transfer_deadline.t_s != "never"
? format(
contract_terms?.wire_transfer_deadline.t_s * 1000,
- "dd MMM yyyy HH:mm:ss",
+ TIME_DATE_FORMAT,
)
: "never"
: `{{ contract_terms.wire_transfer_deadline_str }}`}{" "}
@@ -389,7 +390,7 @@ export function ShowOrderDetails({
? contract_terms?.refund_deadline.t_s != "never"
? format(
contract_terms?.refund_deadline.t_s * 1000,
- "dd MMM yyyy HH:mm:ss",
+ TIME_DATE_FORMAT,
)
: "never"
: `{{ contract_terms.refund_deadline_str }}`}{" "}
diff --git a/packages/merchant-backend-ui/src/utils.ts b/packages/merchant-backend-ui/src/utils.ts
@@ -16,7 +16,7 @@
import { format, formatDuration, intervalToDuration } from "date-fns";
-const TIME_DATE_FORMAT = "dd MMM yyyy HH:mm:ss"
+export const TIME_DATE_FORMAT = "dd MMM yyyy HH:mm:ss"
export function createDateToStringFunction(date: any) {
return () => {