2024-03-27

前段时间更新博客文章时一不小心将 MD 文件上 YAML 区域的时间格式改成了如 2024/03/27 这样的格式。因为 JavaScript 会认为日期字符串中的斜杠表示的是一个无效日期,这时或许通过一层转译,最终在 `toISOString()` 我获取到的时间格式变成了 `2024-03-26T16:00:00.000Z` ,显然并不是我想要的结果。
最后无奈修复了这几篇文章的日期,不知道到时博友们的 RSS 会不会被我更新的文章刷新。
developer.mozilla.org/en-US/do

The MDN Web Docs logo, featuring a blue accent color, displayed on a solid black background.

Date.prototype.toISOString() - JavaScript | MDN

The toISOString() method of Date instances returns a string representing this date in the date time string format, a simplified format based on ISO 8601, which is always 24 or 27 characters long (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ, respectively). The timezone is always UTC, as denoted by the suffix Z.

developer.mozilla.org