Skip to content

Commit

Permalink
fix: cannot save post when the publishTime is blank (halo-dev#763)
Browse files Browse the repository at this point in the history
#### What type of PR is this?

/kind bug

#### What this PR does / why we need it:

修复当文章设置中的发布时间为空字符串时,无法保存的问题。

#### Which issue(s) this PR fixes:

Fixes halo-dev/halo#2906

#### Special notes for your reviewer:

测试方式:

1. 进入新建文章页面。
2. 点击右上角发布按钮,填写必要的标题和别名,然后点击保存。
3. 点击右上角设置按钮,切换到高级设置,再次点击保存。
4. 观察是否正常保存。

#### Does this PR introduce a user-facing change?

```release-note
修复 Console 端文章设置中的发布时间为空字符串时,无法保存的问题。
```
  • Loading branch information
ruibaby authored Dec 12, 2022
1 parent faba6f4 commit 7f9de2f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ const publishTime = computed(() => {
});
const onPublishTimeChange = (value: string) => {
formState.value.spec.publishTime = toISOString(value);
formState.value.spec.publishTime = value ? toISOString(value) : undefined;
};
</script>

Expand Down
2 changes: 1 addition & 1 deletion src/modules/contents/posts/components/PostSettingModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const publishTime = computed(() => {
});
const onPublishTimeChange = (value: string) => {
formState.value.spec.publishTime = toISOString(value);
formState.value.spec.publishTime = value ? toISOString(value) : undefined;
};
</script>
<template>
Expand Down

0 comments on commit 7f9de2f

Please sign in to comment.