This commit is contained in:
1 parent
e6d7f2280b
commit
8efd032cc6
71 files changed
+6796
-3751
No files matched your search
@@ -9,7 +9,8 @@ import { logServerError } from "@/lib/server-log";
|
||||
export async function createVoucher(formData: FormData): Promise<void> {
|
||||
await requireStaff();
|
||||
|
||||
const code = String(formData.get("code") ?? "").normalize("NFC")
|
||||
const code = String(formData.get("code") ?? "")
|
||||
.normalize("NFC")
|
||||
.trim()
|
||||
.slice(0, 255);
|
||||
const amount = Number(formData.get("amount"));
|
||||
@@ -18,7 +19,9 @@ export async function createVoucher(formData: FormData): Promise<void> {
|
||||
|
||||
if (!code || !(amount > 0)) return;
|
||||
|
||||
const expiresRaw = String(formData.get("expiresAt") ?? "").normalize("NFC").trim();
|
||||
const expiresRaw = String(formData.get("expiresAt") ?? "")
|
||||
.normalize("NFC")
|
||||
.trim();
|
||||
let expiresAt: Date | null = null;
|
||||
if (expiresRaw) {
|
||||
const parsed = new Date(expiresRaw);
|
||||
|
||||
Reference in new issue
Block a user