···101101 const socialImage = coalesceAliases(data, ["socialImage", "image", "cover"])
102102103103 const created = coalesceAliases(data, ["created", "date"])
104104- if (created) data.created = created
104104+ if (created) {
105105+ data.created = created
106106+ data.modified ||= created // if modified is not set, use created
107107+ }
108108+105109 const modified = coalesceAliases(data, [
106110 "modified",
107111 "lastmod",
+10
quartz/plugins/transformers/lastmod.ts
···1212 priority: ["frontmatter", "git", "filesystem"],
1313}
14141515+// YYYY-MM-DD
1616+const iso8601DateOnlyRegex = /^\d{4}-\d{2}-\d{2}$/
1717+1518function coerceDate(fp: string, d: any): Date {
1919+ // check ISO8601 date-only format
2020+ // we treat this one as local midnight as the normal
2121+ // js date ctor treats YYYY-MM-DD as UTC midnight
2222+ if (typeof d === "string" && iso8601DateOnlyRegex.test(d)) {
2323+ d = `${d}T00:00:00`
2424+ }
2525+1626 const dt = new Date(d)
1727 const invalidDate = isNaN(dt.getTime()) || dt.getTime() === 0
1828 if (invalidDate && d !== undefined) {