diff --git a/components/form/article/edit-article-form.tsx b/components/form/article/edit-article-form.tsx index c3f8135..d3bd8b3 100644 --- a/components/form/article/edit-article-form.tsx +++ b/components/form/article/edit-article-form.tsx @@ -42,7 +42,7 @@ import GenerateSingleArticleForm from "./generate-ai-single-form"; import { convertDateFormatNoTime, htmlToString } from "@/utils/global"; import { close, error, loading } from "@/config/swal"; import { useParams, useRouter } from "next/navigation"; -import { list } from "postcss"; +import { fromJSON, list } from "postcss"; import GetSeoScore from "./get-seo-score-form"; import Link from "next/link"; import { stringify } from "querystring"; @@ -276,7 +276,7 @@ export default function EditArticleForm(props: { isDetail: boolean }) { const save = async (values: z.infer) => { loading(); - const formData = { + const formData: any = { id: Number(id), title: values.title, typeId: 1, @@ -285,8 +285,12 @@ export default function EditArticleForm(props: { isDetail: boolean }) { tags: values.tags.join(","), description: htmlToString(values.description), htmlDescription: values.description, - createdAt: `${startDateValue} ${timeValue}:00`, + // createdAt: `${startDateValue} ${timeValue}:00`, }; + + if (startDateValue && timeValue) { + formData.createdAt = `${startDateValue} ${timeValue}:00`; + } const response = await updateArticle(String(id), formData); if (response?.error) {