mirror of
https://github.com/etiennecollin/unifi-voucher-manager.git
synced 2025-10-23 00:02:10 +00:00
fix: removed date formatting as it is done in the backend
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
import { Voucher } from "@/types/voucher";
|
||||
import {
|
||||
formatCode,
|
||||
formatDate,
|
||||
formatDuration,
|
||||
formatGuestUsage,
|
||||
} from "@/utils/format";
|
||||
import { formatCode, formatDuration, formatGuestUsage } from "@/utils/format";
|
||||
import { memo } from "react";
|
||||
|
||||
type Props = {
|
||||
@@ -62,7 +57,7 @@ const VoucherCard = ({ voucher, selected, editMode, onClick }: Props) => {
|
||||
{voucher.activatedAt && (
|
||||
<div className="flex justify-between">
|
||||
<span>First Used:</span>
|
||||
<span className="text-xs">{formatDate(voucher.activatedAt)}</span>
|
||||
<span className="text-xs">{voucher.activatedAt}</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -73,9 +68,7 @@ const VoucherCard = ({ voucher, selected, editMode, onClick }: Props) => {
|
||||
{voucher.expired ? "Expired" : "Active"}
|
||||
</span>
|
||||
{voucher.expiresAt && (
|
||||
<span className="text-xs">
|
||||
Expires: {formatDate(voucher.expiresAt)}
|
||||
</span>
|
||||
<span className="text-xs">Expires: {voucher.expiresAt}</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -6,7 +6,6 @@ import { api } from "@/utils/api";
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import {
|
||||
formatBytes,
|
||||
formatDate,
|
||||
formatDuration,
|
||||
formatGuestUsage,
|
||||
formatSpeed,
|
||||
@@ -64,13 +63,11 @@ export default function VoucherModal({ voucher, onClose }: Props) {
|
||||
[
|
||||
["Status", details.expired ? "Expired" : "Active"],
|
||||
["Name", details.name || "No note"],
|
||||
["Created", formatDate(details.createdAt)],
|
||||
["Created", details.createdAt],
|
||||
...(details.activatedAt
|
||||
? [["Activated", formatDate(details.activatedAt)]]
|
||||
: []),
|
||||
...(details.expiresAt
|
||||
? [["Expires", formatDate(details.expiresAt)]]
|
||||
? [["Activated", details.activatedAt]]
|
||||
: []),
|
||||
...(details.expiresAt ? [["Expires", details.expiresAt]] : []),
|
||||
["Duration", formatDuration(details.timeLimitMinutes)],
|
||||
[
|
||||
"Guest Usage",
|
||||
|
@@ -2,10 +2,6 @@ export function formatCode(code: string) {
|
||||
return code.length === 10 ? code.replace(/(.{5})(.{5})/, "$1-$2") : code;
|
||||
}
|
||||
|
||||
export function formatDate(d: string) {
|
||||
return new Date(d).toLocaleString();
|
||||
}
|
||||
|
||||
export function formatDuration(m: number | null | undefined) {
|
||||
if (!m) return "Unlimited";
|
||||
const days = Math.floor(m / 1440),
|
||||
|
Reference in New Issue
Block a user