# 在“关于我”中插入日期/时间

**URL:** https://meta.discourse.org/t/inserting-date-time-in-about-me/137528
**Category:** Feature
**Created:** [2020年一月2日 03:51 UTC](https://meta.discourse.org/t/inserting-date-time-in-about-me/137528 "2020-01-02T03:51:59Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![wadestriebel](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/wadestriebel/32/167628_2.png) [@wadestriebel](https://meta.discourse.org/u/wadestriebel)
#### Post date: [2020年一月2日 03:51 UTC](https://meta.discourse.org/t/inserting-date-time-in-about-me/137528/1 "2020-01-02T03:51:59Z")

</div>

在“关于我”部分插入日期/时间时，其格式被显示为 datetime，而非预期的日期和时间格式。

### 插入日期/时间

 ![Screen Shot 2020-01-01 at 9.42.39 PM](https://global.discourse-cdn.com/meta/original/3X/1/c/1c77b2de5d4aa2114d391d758197974a00f7413b.png)

### 公开个人资料

 ![Screen Shot 2020-01-01 at 9.43.51 PM](https://global.discourse-cdn.com/meta/original/3X/1/a/1a1ac18eb83c69aca469c98fde9bee9f2d8ecc1b.png)

#### Discourse 信息：

- 已安装 2.4.0.beta9 ([e36efb1edc](https://github.com/discourse/discourse/commits/e36efb1edcb23abd0c91f37fe576d1850bbd1cd7))

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2020年一月2日 04:53 UTC](https://meta.discourse.org/t/inserting-date-time-in-about-me/137528/2 "2020-01-02T04:53:40Z")

</div>

我认为“关于我”部分不支持这种日期格式。

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [2020年一月2日 07:58 UTC](https://meta.discourse.org/t/inserting-date-time-in-about-me/137528/3 "2020-01-02T07:58:24Z")

</div>

嗯，我认为我们不需要在“关于我”部分运行完整的帖子装饰功能（也不应该这样做）。不过，考虑到工具栏中已经显示了日期选择器，在那里添加对其的支持应该不会太难。

@j.jaffeux 你怎么看？

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2020年一月8日 09:17 UTC](https://meta.discourse.org/t/inserting-date-time-in-about-me/137528/5 "2020-01-08T09:17:38Z")

</div>

所以我可以很轻松地实现它：

 ![Screenshot 2020-01-08 at 10.12.20](https://global.discourse-cdn.com/meta/original/3X/5/3/5366932099561497205b24e4e1014915286bf612.png)

但这有一个我们认为我们不愿付出的代价：

- 目前在个人资料（bio）中，我们渲染的是 `bio_excerpt` 而不是单纯的 `bio_cooked`，这可能意味着日期会被截断，并且我们会移除 HTML：

```plaintext
[1] pry(main)> PrettyText.excerpt("<b>Foo</b>", 5)
=> "Foo"

```

- 此外，我们是将其作为文本渲染，并使用 `{{text-overflow}}` 组件。

因此，如果不疯狂地构建某种 postCooked 钩子，就无法在不修改以下代码的情况下实现该功能：

```plaintext
<div class='bio'>{{text-overflow class="overflow" text=user.bio_excerpt}}</div>

```

改为：

```plaintext
<div class='bio'>{{{user.bio_cooked}}}</div>

```

我认为我们不应该为了这样一个特定的边缘情况而这样做，因为这基本上意味着我们要直接渲染来自用户输入的 HTML。由你决定，如果你希望进一步深入研究或探索其他解决方案，请告诉我。

或许更安全的做法是直接从“关于”编辑器的工具栏中移除该按钮？

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [2020年一月9日 02:45 UTC](https://meta.discourse.org/t/inserting-date-time-in-about-me/137528/6 "2020-01-09T02:45:54Z")

</div>

好的，请移除该按钮。

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2020年二月24日 23:18 UTC](https://meta.discourse.org/t/inserting-date-time-in-about-me/137528/7 "2020-02-24T23:18:04Z")

</div>

已完成：

> <https://github.com/discourse/discourse/commit/e303b4d1818422863ac8cc17b34dd65186f50989>

---

<div class="post-metadata">

### Author: ![j.jaffeux](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/j.jaffeux/32/60297_2.png) [@j.jaffeux](https://meta.discourse.org/u/j.jaffeux)
#### Post date: [2020年二月24日 23:18 UTC](https://meta.discourse.org/t/inserting-date-time-in-about-me/137528/8 "2020-02-24T23:18:10Z")

</div>


