Fix: Prevent unwanted automatic updates to publishDate field on save

Co-authored-by: estruyf <2900833+estruyf@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-03-14 10:39:51 +00:00
parent 90f181a05c
commit cde03e8fcf
2 changed files with 7 additions and 2 deletions
+3 -1
View File
@@ -502,7 +502,9 @@ export class ArticleHelper {
*/
public static async updateDates(article: ParsedFrontMatter) {
const contentType = await ArticleHelper.getContentType(article);
const dateFields = contentType.fields.filter((field) => field.type === 'datetime');
const dateFields = contentType.fields.filter(
(field) => field.type === 'datetime' && !field.isPublishDate
);
for (const dateField of dateFields) {
if (article?.data[dateField.name]) {
+4 -1
View File
@@ -40,7 +40,10 @@ export const Engines = {
return toml.parse(value);
},
stringify: (value: any) => {
return toml.stringify(value);
const result = toml.stringify(value);
// Preserve the original datetime format by removing unnecessary zero milliseconds
// e.g. 2025-09-12T10:00:00.000Z -> 2025-09-12T10:00:00Z
return result.replace(/(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2})\.000([Z+-][\d:]*)?\b/g, '$1$2');
}
},
yaml: {