merchant-backoffice

ZZZ: Inactive/Deprecated
Log | Files | Refs | Submodules | README

commit 35af67df3cda2c79c5ca9de78498f21f7d559db2
parent 6c514131d30f974f588494b44a2c4dde96168c88
Author: Sebastian <sebasjm@gmail.com>
Date:   Fri,  1 Apr 2022 14:42:50 -0300

fix conversion between new timestamp format and javascript date

Diffstat:
Mpackages/merchant-backoffice/src/components/form/InputDate.tsx | 4++--
Mpackages/merchant-backoffice/src/components/form/InputDuration.tsx | 2+-
Mpackages/merchant-backoffice/src/components/form/InputStock.stories.tsx | 4++--
Mpackages/merchant-backoffice/src/components/picker/DurationPicker.tsx | 218++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------
Mpackages/merchant-backoffice/src/components/product/ProductForm.tsx | 2+-
Mpackages/merchant-backoffice/src/hooks/order.ts | 4++--
Mpackages/merchant-backoffice/src/paths/instance/orders/create/CreatePage.tsx | 16++++++----------
Mpackages/merchant-backoffice/src/paths/instance/orders/details/Detail.stories.tsx | 6+++---
Mpackages/merchant-backoffice/src/paths/instance/orders/details/DetailPage.tsx | 86+++++++++++++++++++++++++++++++++++++++++++++----------------------------------
Mpackages/merchant-backoffice/src/paths/instance/orders/list/List.stories.tsx | 8++++----
Mpackages/merchant-backoffice/src/paths/instance/orders/list/Table.tsx | 17++++++++++++-----
Mpackages/merchant-backoffice/src/paths/instance/products/list/Table.tsx | 2+-
Mpackages/merchant-backoffice/src/paths/instance/reserves/details/Details.stories.tsx | 12++++++------
Mpackages/merchant-backoffice/src/paths/instance/reserves/list/List.stories.tsx | 12++++++------
Mpackages/merchant-backoffice/src/paths/instance/transfers/list/List.stories.tsx | 6+++---
15 files changed, 235 insertions(+), 164 deletions(-)

diff --git a/packages/merchant-backoffice/src/components/form/InputDate.tsx b/packages/merchant-backoffice/src/components/form/InputDate.tsx @@ -58,7 +58,7 @@ export function InputDate<T>({ ? withTimestampSupport ? "never" : "" - : format(new Date(value.t_s), "yyyy/MM/dd"); + : format(new Date(value.t_s * 1000), "yyyy/MM/dd"); } return ( @@ -148,7 +148,7 @@ export function InputDate<T>({ closeFunction={() => setOpened(false)} dateReceiver={(d) => { if (withTimestampSupport) { - onChange({ t_s: d.getTime() } as any); + onChange({ t_s: d.getTime() / 1000 } as any); } else { onChange(d as any); } diff --git a/packages/merchant-backoffice/src/components/form/InputDuration.tsx b/packages/merchant-backoffice/src/components/form/InputDuration.tsx @@ -53,7 +53,7 @@ export function InputDuration<T>({ strValue = i18n`forever`; } else { strValue = formatDuration( - intervalToDuration({ start: 0, end: value.d_us }), + intervalToDuration({ start: 0, end: value.d_us / 1000 }), { locale: { formatDistance: (name, value) => { diff --git a/packages/merchant-backoffice/src/components/form/InputStock.stories.tsx b/packages/merchant-backoffice/src/components/form/InputStock.stories.tsx @@ -102,7 +102,7 @@ export const CreateStockWithRestock = () => { current: 15, lost: 0, sold: 0, - nextRestock: { t_s: addDays(new Date(), 1).getTime() }, + nextRestock: { t_s: addDays(new Date(), 1).getTime() / 1000 }, }, }); return ( @@ -126,7 +126,7 @@ export const UpdatingProductWithManagedStock = () => { current: 100, lost: 0, sold: 0, - nextRestock: { t_s: addDays(new Date(), 1).getTime() }, + nextRestock: { t_s: addDays(new Date(), 1).getTime() / 1000 }, }, }); return ( diff --git a/packages/merchant-backoffice/src/components/picker/DurationPicker.tsx b/packages/merchant-backoffice/src/components/picker/DurationPicker.tsx @@ -15,9 +15,9 @@ */ /** -* -* @author Sebastian Javier Marchano (sebasjm) -*/ + * + * @author Sebastian Javier Marchano (sebasjm) + */ import { h, VNode } from "preact"; import { useState } from "preact/hooks"; @@ -30,75 +30,123 @@ export interface Props { seconds?: boolean; days?: boolean; onChange: (value: number) => void; - value: number + value: number; } // inspiration taken from https://github.com/flurmbo/react-duration-picker -export function DurationPicker({ days, hours, minutes, seconds, onChange, value }: Props): VNode { - const ss = 1000 - const ms = ss * 60 - const hs = ms * 60 - const ds = hs * 24 - const i18n = useTranslator() - - return <div class="rdp-picker"> - {days && <DurationColumn unit={i18n`days`} max={99} - value={Math.floor(value / ds)} - onDecrease={value >= ds ? () => onChange(value - ds) : undefined} - onIncrease={value < 99 * ds ? () => onChange(value + ds) : undefined} - onChange={diff => onChange(value + diff * ds)} - />} - {hours && <DurationColumn unit={i18n`hours`} max={23} min={1} - value={Math.floor(value / hs) % 24} - onDecrease={value >= hs ? () => onChange(value - hs) : undefined} - onIncrease={value < 99 * ds ? () => onChange(value + hs) : undefined} - onChange={diff => onChange(value + diff * hs)} - />} - {minutes && <DurationColumn unit={i18n`minutes`} max={59} min={1} - value={Math.floor(value / ms) % 60} - onDecrease={value >= ms ? () => onChange(value - ms) : undefined} - onIncrease={value < 99 * ds ? () => onChange(value + ms) : undefined} - onChange={diff => onChange(value + diff * ms)} - />} - {seconds && <DurationColumn unit={i18n`seconds`} max={59} - value={Math.floor(value / ss) % 60} - onDecrease={value >= ss ? () => onChange(value - ss) : undefined} - onIncrease={value < 99 * ds ? () => onChange(value + ss) : undefined} - onChange={diff => onChange(value + diff * ss)} - />} - </div> +export function DurationPicker({ + days, + hours, + minutes, + seconds, + onChange, + value, +}: Props): VNode { + const ss = 1000 * 1000; + const ms = ss * 60; + const hs = ms * 60; + const ds = hs * 24; + const i18n = useTranslator(); + + return ( + <div class="rdp-picker"> + {days && ( + <DurationColumn + unit={i18n`days`} + max={99} + value={Math.floor(value / ds)} + onDecrease={value >= ds ? () => onChange(value - ds) : undefined} + onIncrease={value < 99 * ds ? () => onChange(value + ds) : undefined} + onChange={(diff) => onChange(value + diff * ds)} + /> + )} + {hours && ( + <DurationColumn + unit={i18n`hours`} + max={23} + min={1} + value={Math.floor(value / hs) % 24} + onDecrease={value >= hs ? () => onChange(value - hs) : undefined} + onIncrease={value < 99 * ds ? () => onChange(value + hs) : undefined} + onChange={(diff) => onChange(value + diff * hs)} + /> + )} + {minutes && ( + <DurationColumn + unit={i18n`minutes`} + max={59} + min={1} + value={Math.floor(value / ms) % 60} + onDecrease={value >= ms ? () => onChange(value - ms) : undefined} + onIncrease={value < 99 * ds ? () => onChange(value + ms) : undefined} + onChange={(diff) => onChange(value + diff * ms)} + /> + )} + {seconds && ( + <DurationColumn + unit={i18n`seconds`} + max={59} + value={Math.floor(value / ss) % 60} + onDecrease={value >= ss ? () => onChange(value - ss) : undefined} + onIncrease={value < 99 * ds ? () => onChange(value + ss) : undefined} + onChange={(diff) => onChange(value + diff * ss)} + /> + )} + </div> + ); } interface ColProps { - unit: string, - min?: number, - max: number, - value: number, + unit: string; + min?: number; + max: number; + value: number; onIncrease?: () => void; onDecrease?: () => void; onChange?: (diff: number) => void; } -function InputNumber({ initial, onChange }: { initial: number, onChange: (n: number) => void }) { - const [value, handler] = useState<{v:string}>({ - v: toTwoDigitString(initial) - }) - - return <input - value={value.v} - onBlur={(e) => onChange(parseInt(value.v, 10))} - onInput={(e) => { - e.preventDefault() - const n = Number.parseInt(e.currentTarget.value, 10); - if (isNaN(n)) return handler({v:toTwoDigitString(initial)}) - return handler({v:toTwoDigitString(n)}) - }} - style={{ width: 50, border: 'none', fontSize: 'inherit', background: 'inherit' }} /> -} +function InputNumber({ + initial, + onChange, +}: { + initial: number; + onChange: (n: number) => void; +}) { + const [value, handler] = useState<{ v: string }>({ + v: toTwoDigitString(initial), + }); -function DurationColumn({ unit, min = 0, max, value, onIncrease, onDecrease, onChange }: ColProps): VNode { + return ( + <input + value={value.v} + onBlur={(e) => onChange(parseInt(value.v, 10))} + onInput={(e) => { + e.preventDefault(); + const n = Number.parseInt(e.currentTarget.value, 10); + if (isNaN(n)) return handler({ v: toTwoDigitString(initial) }); + return handler({ v: toTwoDigitString(n) }); + }} + style={{ + width: 50, + border: "none", + fontSize: "inherit", + background: "inherit", + }} + /> + ); +} - const cellHeight = 35 +function DurationColumn({ + unit, + min = 0, + max, + value, + onIncrease, + onDecrease, + onChange, +}: ColProps): VNode { + const cellHeight = 35; return ( <div class="rdp-column-container"> <div class="rdp-masked-div"> @@ -106,49 +154,58 @@ function DurationColumn({ unit, min = 0, max, value, onIncrease, onDecrease, onC <hr class="rdp-reticule" style={{ top: cellHeight * 3 - 1 }} /> <div class="rdp-column" style={{ top: 0 }}> - <div class="rdp-cell" key={value - 2}> - {onDecrease && <button style={{ width: '100%', textAlign: 'center', margin: 5 }} - onClick={onDecrease}> - <span class="icon"> - <i class="mdi mdi-chevron-up" /> - </span> - </button>} + {onDecrease && ( + <button + style={{ width: "100%", textAlign: "center", margin: 5 }} + onClick={onDecrease} + > + <span class="icon"> + <i class="mdi mdi-chevron-up" /> + </span> + </button> + )} </div> <div class="rdp-cell" key={value - 1}> - {value > min ? toTwoDigitString(value - 1) : ''} + {value > min ? toTwoDigitString(value - 1) : ""} </div> <div class="rdp-cell rdp-center" key={value}> - {onChange ? - <InputNumber initial={value} onChange={(n) => onChange(n - value)} /> : + {onChange ? ( + <InputNumber + initial={value} + onChange={(n) => onChange(n - value)} + /> + ) : ( toTwoDigitString(value) - } + )} <div>{unit}</div> </div> <div class="rdp-cell" key={value + 1}> - {value < max ? toTwoDigitString(value + 1) : ''} + {value < max ? toTwoDigitString(value + 1) : ""} </div> <div class="rdp-cell" key={value + 2}> - {onIncrease && <button style={{ width: '100%', textAlign: 'center', margin: 5 }} - onClick={onIncrease}> - <span class="icon"> - <i class="mdi mdi-chevron-down" /> - </span> - </button>} + {onIncrease && ( + <button + style={{ width: "100%", textAlign: "center", margin: 5 }} + onClick={onIncrease} + > + <span class="icon"> + <i class="mdi mdi-chevron-down" /> + </span> + </button> + )} </div> - </div> </div> </div> ); } - function toTwoDigitString(n: number) { if (n < 10) { return `0${n}`; } return `${n}`; -} -\ No newline at end of file +} diff --git a/packages/merchant-backoffice/src/components/product/ProductForm.tsx b/packages/merchant-backoffice/src/components/product/ProductForm.tsx @@ -94,7 +94,7 @@ export function ProductForm({ onSubscribe, initial, alreadyExist }: Props) { value.total_lost = stock.lost; value.next_restock = stock.nextRestock instanceof Date - ? { t_s: stock.nextRestock.getTime() } + ? { t_s: stock.nextRestock.getTime() / 1000 } : stock.nextRestock; value.address = stock.address; } diff --git a/packages/merchant-backoffice/src/hooks/order.ts b/packages/merchant-backoffice/src/hooks/order.ts @@ -292,7 +292,7 @@ export function useInstanceOrders( const from = afterData.data.orders[afterData.data.orders.length - 1].timestamp .t_s; - if (from && updateFilter) updateFilter(new Date(from)); + if (from && from !== "never" && updateFilter) updateFilter(new Date(from * 1000)); } }, loadMorePrev: () => { @@ -303,7 +303,7 @@ export function useInstanceOrders( const from = beforeData.data.orders[beforeData.data.orders.length - 1].timestamp .t_s; - if (from && updateFilter) updateFilter(new Date(from)); + if (from && from !== "never" && updateFilter) updateFilter(new Date(from * 1000)); } }, }; diff --git a/packages/merchant-backoffice/src/paths/instance/orders/create/CreatePage.tsx b/packages/merchant-backoffice/src/paths/instance/orders/create/CreatePage.tsx @@ -223,23 +223,19 @@ export function CreatePage({ extra: value.extra, pay_deadline: value.payments.pay_deadline ? { - t_s: - Math.floor(value.payments.pay_deadline.getTime() / 1000) * 1000, + t_s: Math.floor(value.payments.pay_deadline.getTime() / 1000), } : undefined, wire_transfer_deadline: value.payments.wire_transfer_deadline ? { - t_s: - Math.floor( - value.payments.wire_transfer_deadline.getTime() / 1000 - ) * 1000, + t_s: Math.floor( + value.payments.wire_transfer_deadline.getTime() / 1000 + ), } : undefined, refund_deadline: value.payments.refund_deadline ? { - t_s: - Math.floor(value.payments.refund_deadline.getTime() / 1000) * - 1000, + t_s: Math.floor(value.payments.refund_deadline.getTime() / 1000), } : undefined, wire_fee_amortization: value.payments.wire_fee_amortization, @@ -247,7 +243,7 @@ export function CreatePage({ max_wire_fee: value.payments.max_wire_fee, delivery_date: value.shipping.delivery_date - ? { t_s: value.shipping.delivery_date.getTime() } + ? { t_s: value.shipping.delivery_date.getTime() / 1000 } : undefined, delivery_location: value.shipping.delivery_location, fulfillment_url: value.shipping.fullfilment_url, diff --git a/packages/merchant-backoffice/src/paths/instance/orders/details/Detail.stories.tsx b/packages/merchant-backoffice/src/paths/instance/orders/details/Detail.stories.tsx @@ -45,7 +45,7 @@ function createExample<Props>( const defaultContractTerm = { amount: "TESTKUDOS:10", timestamp: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, auditors: [], exchanges: [], @@ -105,7 +105,7 @@ export const PaidRefundable = createExample(TestedComponent, { contract_terms: { ...defaultContractTerm, refund_deadline: { - t_s: addDays(new Date(), 2).getTime(), + t_s: addDays(new Date(), 2).getTime() / 1000, }, }, refunded: false, @@ -128,7 +128,7 @@ export const Unpaid = createExample(TestedComponent, { order_status: "unpaid", order_status_url: "http://merchant.backend/status", creation_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, summary: "text summary", taler_pay_uri: "pay uri", diff --git a/packages/merchant-backoffice/src/paths/instance/orders/details/DetailPage.tsx b/packages/merchant-backoffice/src/paths/instance/orders/details/DetailPage.tsx @@ -162,28 +162,28 @@ function ClaimedPage({ const events: Event[] = []; if (order.contract_terms.timestamp.t_s !== "never") { events.push({ - when: new Date(order.contract_terms.timestamp.t_s), + when: new Date(order.contract_terms.timestamp.t_s * 1000), description: "order created", type: "start", }); } if (order.contract_terms.pay_deadline.t_s !== "never") { events.push({ - when: new Date(order.contract_terms.pay_deadline.t_s), + when: new Date(order.contract_terms.pay_deadline.t_s * 1000), description: "pay deadline", type: "deadline", }); } if (order.contract_terms.refund_deadline.t_s !== "never") { events.push({ - when: new Date(order.contract_terms.refund_deadline.t_s), + when: new Date(order.contract_terms.refund_deadline.t_s * 1000), description: "refund deadline", type: "deadline", }); } if (order.contract_terms.wire_transfer_deadline.t_s !== "never") { events.push({ - when: new Date(order.contract_terms.wire_transfer_deadline.t_s), + when: new Date(order.contract_terms.wire_transfer_deadline.t_s * 1000), description: "wire deadline", type: "deadline", }); @@ -193,7 +193,7 @@ function ClaimedPage({ order.contract_terms.delivery_date.t_s !== "never" ) { events.push({ - when: new Date(order.contract_terms.delivery_date?.t_s), + when: new Date(order.contract_terms.delivery_date?.t_s * 1000), description: "delivery", type: "delivery", }); @@ -244,7 +244,7 @@ function ClaimedPage({ <Translate>claimed at</Translate>: </b>{" "} {format( - new Date(order.contract_terms.timestamp.t_s), + new Date(order.contract_terms.timestamp.t_s * 1000), "yyyy-MM-dd HH:mm:ss" )} </p> @@ -323,28 +323,28 @@ function PaidPage({ const events: Event[] = []; if (order.contract_terms.timestamp.t_s !== "never") { events.push({ - when: new Date(order.contract_terms.timestamp.t_s), + when: new Date(order.contract_terms.timestamp.t_s * 1000), description: "order created", type: "start", }); } if (order.contract_terms.pay_deadline.t_s !== "never") { events.push({ - when: new Date(order.contract_terms.pay_deadline.t_s), + when: new Date(order.contract_terms.pay_deadline.t_s * 1000), description: "pay deadline", type: "deadline", }); } if (order.contract_terms.refund_deadline.t_s !== "never") { events.push({ - when: new Date(order.contract_terms.refund_deadline.t_s), + when: new Date(order.contract_terms.refund_deadline.t_s * 1000), description: "refund deadline", type: "deadline", }); } if (order.contract_terms.wire_transfer_deadline.t_s !== "never") { events.push({ - when: new Date(order.contract_terms.wire_transfer_deadline.t_s), + when: new Date(order.contract_terms.wire_transfer_deadline.t_s * 1000), description: "wire deadline", type: "deadline", }); @@ -355,17 +355,19 @@ function PaidPage({ ) { if (order.contract_terms.delivery_date) events.push({ - when: new Date(order.contract_terms.delivery_date?.t_s), + when: new Date(order.contract_terms.delivery_date?.t_s * 1000), description: "delivery", type: "delivery", }); } order.refund_details.reduce(mergeRefunds, []).forEach((e) => { - events.push({ - when: new Date(e.timestamp.t_s), - description: `refund: ${e.amount}: ${e.reason}`, - type: "refund", - }); + if (e.timestamp.t_s !== "never") { + events.push({ + when: new Date(e.timestamp.t_s * 1000), + description: `refund: ${e.amount}: ${e.reason}`, + type: "refund", + }); + } }); if (order.wire_details && order.wire_details.length) { if (order.wire_details.length > 1) { @@ -385,23 +387,31 @@ function PaidPage({ ? Amounts.parseOrThrow(w.amount) : Amounts.add(total, Amounts.parseOrThrow(w.amount)).amount; }); - events.push({ - when: new Date(last!.execution_time.t_s), - description: `wired ${Amounts.stringify(total!)}`, - type: "wired-range", - }); - events.push({ - when: new Date(first!.execution_time.t_s), - description: `wire transfer started...`, - type: "wired-range", - }); - } else { - order.wire_details.forEach((e) => { + const last_time = last!.execution_time.t_s; + if (last_time !== "never") { + events.push({ + when: new Date(last_time * 1000), + description: `wired ${Amounts.stringify(total!)}`, + type: "wired-range", + }); + } + const first_time = first!.execution_time.t_s; + if (first_time !== "never") { events.push({ - when: new Date(e.execution_time.t_s), - description: `wired ${e.amount}`, - type: "wired", + when: new Date(first_time * 1000), + description: `wire transfer started...`, + type: "wired-range", }); + } + } else { + order.wire_details.forEach((e) => { + if (e.execution_time.t_s !== "never") { + events.push({ + when: new Date(e.execution_time.t_s * 1000), + description: `wired ${e.amount}`, + type: "wired", + }); + } }); } } @@ -409,7 +419,7 @@ function PaidPage({ const [value, valueHandler] = useState<Partial<Paid>>(order); const refundable = - new Date().getTime() < order.contract_terms.refund_deadline.t_s; + new Date().getTime() < order.contract_terms.refund_deadline.t_s * 1000; const i18n = useTranslator(); return ( @@ -495,7 +505,7 @@ function PaidPage({ </p> <p> {format( - new Date(order.contract_terms.timestamp.t_s), + new Date(order.contract_terms.timestamp.t_s * 1000), "yyyy/MM/dd HH:mm:ss" )} </p> @@ -625,10 +635,12 @@ function UnpaidPage({ <b> <Translate>created at</Translate>: </b>{" "} - {format( - new Date(order.creation_time.t_s), - "yyyy-MM-dd HH:mm:ss" - )} + {order.creation_time.t_s === "never" + ? "never" + : format( + new Date(order.creation_time.t_s * 1000), + "yyyy-MM-dd HH:mm:ss" + )} </p> </div> </div> diff --git a/packages/merchant-backoffice/src/paths/instance/orders/list/List.stories.tsx b/packages/merchant-backoffice/src/paths/instance/orders/list/List.stories.tsx @@ -60,7 +60,7 @@ export const Example = createExample(TestedComponent, { row_id: 1, summary: "summary", timestamp: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, order_id: "123", }, @@ -73,7 +73,7 @@ export const Example = createExample(TestedComponent, { summary: "summary with long text, very very long text that someone want to add as a description of the order", timestamp: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, order_id: "234", }, @@ -86,7 +86,7 @@ export const Example = createExample(TestedComponent, { summary: "summary with long text, very very long text that someone want to add as a description of the order", timestamp: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, order_id: "456", }, @@ -99,7 +99,7 @@ export const Example = createExample(TestedComponent, { summary: "summary with long text, very very long text that someone want to add as a description of the order", timestamp: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, order_id: "234", }, diff --git a/packages/merchant-backoffice/src/paths/instance/orders/list/Table.tsx b/packages/merchant-backoffice/src/paths/instance/orders/list/Table.tsx @@ -171,7 +171,12 @@ function Table({ onClick={(): void => onSelect(i)} style={{ cursor: "pointer" }} > - {format(new Date(i.timestamp.t_s), "yyyy/MM/dd HH:mm:ss")} + {i.timestamp.t_s === "never" + ? "never" + : format( + new Date(i.timestamp.t_s * 1000), + "yyyy/MM/dd HH:mm:ss" + )} </td> <td onClick={(): void => onSelect(i)} @@ -337,10 +342,12 @@ export function RefundModal({ return ( <tr key={r.timestamp.t_s}> <td> - {format( - new Date(r.timestamp.t_s), - "yyyy-MM-dd HH:mm:ss" - )} + {r.timestamp.t_s === "never" + ? "never" + : format( + new Date(r.timestamp.t_s * 1000), + "yyyy-MM-dd HH:mm:ss" + )} </td> <td>{r.amount}</td> <td>{r.reason}</td> diff --git a/packages/merchant-backoffice/src/paths/instance/products/list/Table.tsx b/packages/merchant-backoffice/src/paths/instance/products/list/Table.tsx @@ -158,7 +158,7 @@ function Table({ : i.next_restock.t_s === "never" ? "never" : `restock at ${format( - new Date(i.next_restock.t_s), + new Date(i.next_restock.t_s * 1000), "yyyy/MM/dd" )}`; let stockInfo: ComponentChildren = ""; diff --git a/packages/merchant-backoffice/src/paths/instance/reserves/details/Details.stories.tsx b/packages/merchant-backoffice/src/paths/instance/reserves/details/Details.stories.tsx @@ -46,11 +46,11 @@ export const Funded = createExample(TestedComponent, { active: true, committed_amount: "TESTKUDOS:10", creation_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, exchange_initial_amount: "TESTKUDOS:10", expiration_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, merchant_initial_amount: "TESTKUDOS:10", pickup_amount: "TESTKUDOS:10", @@ -65,11 +65,11 @@ export const NotYetFunded = createExample(TestedComponent, { active: true, committed_amount: "TESTKUDOS:10", creation_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, exchange_initial_amount: "TESTKUDOS:0", expiration_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, merchant_initial_amount: "TESTKUDOS:10", pickup_amount: "TESTKUDOS:10", @@ -84,11 +84,11 @@ export const FundedWithEmptyTips = createExample(TestedComponent, { active: true, committed_amount: "TESTKUDOS:10", creation_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, exchange_initial_amount: "TESTKUDOS:10", expiration_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, merchant_initial_amount: "TESTKUDOS:10", pickup_amount: "TESTKUDOS:10", diff --git a/packages/merchant-backoffice/src/paths/instance/reserves/list/List.stories.tsx b/packages/merchant-backoffice/src/paths/instance/reserves/list/List.stories.tsx @@ -49,11 +49,11 @@ export const AllFunded = createExample(TestedComponent, { active: true, committed_amount: "TESTKUDOS:10", creation_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, exchange_initial_amount: "TESTKUDOS:10", expiration_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, merchant_initial_amount: "TESTKUDOS:10", pickup_amount: "TESTKUDOS:10", @@ -64,11 +64,11 @@ export const AllFunded = createExample(TestedComponent, { active: true, committed_amount: "TESTKUDOS:13", creation_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, exchange_initial_amount: "TESTKUDOS:10", expiration_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, merchant_initial_amount: "TESTKUDOS:10", pickup_amount: "TESTKUDOS:10", @@ -88,11 +88,11 @@ export const OneNotYetFunded = createExample(TestedComponent, { active: true, committed_amount: "TESTKUDOS:0", creation_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, exchange_initial_amount: "TESTKUDOS:0", expiration_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, merchant_initial_amount: "TESTKUDOS:10", pickup_amount: "TESTKUDOS:10", diff --git a/packages/merchant-backoffice/src/paths/instance/transfers/list/List.stories.tsx b/packages/merchant-backoffice/src/paths/instance/transfers/list/List.stories.tsx @@ -56,7 +56,7 @@ export const Example = createExample(TestedComponent, { wtid: "!@KJELQKWEJ!L@K#!J@", confirmed: true, execution_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, verified: false, }, @@ -68,7 +68,7 @@ export const Example = createExample(TestedComponent, { wtid: "!@KJELQKWEJ!L@K#!J@", confirmed: true, execution_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, verified: false, }, @@ -80,7 +80,7 @@ export const Example = createExample(TestedComponent, { wtid: "!@KJELQKWEJ!L@K#!J@", confirmed: true, execution_time: { - t_s: new Date().getTime(), + t_s: new Date().getTime() / 1000, }, verified: false, },