Minor bugfix on JobAdCreate

This commit is contained in:
Aarni Halinen
2020-11-24 18:03:16 +02:00
parent 659af09fb7
commit 0f0961452b
+4 -3
View File
@@ -15,7 +15,8 @@ const widgets = {
const buildSchema = (title: string) => {
const date = new Date();
const monthFromNow = new Date().setDate(date.getDate() + 30)
const monthFromNow = new Date();
monthFromNow.setDate(date.getDate() + 30);
const schema = {
title,
@@ -35,7 +36,7 @@ const buildSchema = (title: string) => {
autohide_at: {
type: "string",
title: "Autohide time",
default: monthFromNow,
default: monthFromNow.toISOString(),
},
finnish_section_divider: {
title: "Finnish",
@@ -116,7 +117,7 @@ const JobAdCreatePage: React.FC<JobAdCreatePageProps> = ({ match: { params: { id
const [formData, setFormData] = useState<JobAd>(null);
useEffect(() => {
const jobId = Number(id);
const jobId = id && Number(id);
if (jobId !== undefined) {
getJobAd(jobId, true)
.then(res => setFormData(res))