# 禁用草稿和发布的内容类型，其 publishedAt 值总是设置为某个日期

> Source: https://strapi.nodejs.cn/cms/migration/v4-to-v5/breaking-changes/publishedat-always-set-when-dandp-disabled

🌐 Content types with Draft & Publish disabled always have the publishedAt value set to a date

在 Strapi 5 中，禁用草稿和发布的内容类型总是将 `publishedAt` 属性设置为日期，而在 v4 中该属性不存在。

🌐 In Strapi 5, content-types with Draft & Publish disabled always have the `publishedAt` attribute set to a date, whereas in v4 the attribute did not exist.

在 Strapi 5 中，禁用“草稿和发布”的内容类型的 publishedAt 值总是会被设置为一个日期。

此页面是[重大更改数据库](/cms/migration/v4-to-v5/breaking-changes)的一部分，提供关于重大更改的信息以及从 Strapi v4 迁移到 Strapi 5 的附加说明。

🌐 This page is part of the [breaking changes database](/cms/migration/v4-to-v5/breaking-changes) and provides information about the breaking change and additional instructions to migrate from Strapi v4 to Strapi 5.

- Is this breaking change affecting plugins? Yes
- Is this breaking change automatically handled by a codemod? No

## 重大变更描述 {#breaking-change-description}

🌐 Breaking change description

**在 Strapi v4 中**

在 Strapi v4 中，草稿与发布功能禁用的内容类型甚至没有 `publishedAt` 属性。

🌐 In Strapi v4, a content-type with Draft & Publish disabled does not even have a `publishedAt` attribute.

**在 Strapi 5 中**

在 Strapi 5 中，即使内容类型禁用了草稿与发布，`publishedAt` 属性也始终存在。

🌐 In Strapi 5, the `publishedAt` attribute always exist even if Draft & Publish is disabled for a content-types.

## 迁移 {#migration}

🌐 Migration

本节重新组合了有关引入的重大更改的有用说明和程序。

🌐 This section regroups useful notes and procedures about the introduced breaking change.

### 注意 {#notes}

🌐 Notes

* 如果启用草稿与发布，`publishedAt` 是：
  * `null` 用于文档的草稿版本
  * 并设置为已发布版本的文档的发布日期。
* 如果禁用草稿和发布，`publishedAt` 将设置为文档的最新创建或编辑日期。
