The Trans Directory
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: tz-less date parse in local tz instead of utc (closes #1615)

+15 -1
+5 -1
quartz/plugins/transformers/frontmatter.ts
··· 101 101 const socialImage = coalesceAliases(data, ["socialImage", "image", "cover"]) 102 102 103 103 const created = coalesceAliases(data, ["created", "date"]) 104 - if (created) data.created = created 104 + if (created) { 105 + data.created = created 106 + data.modified ||= created // if modified is not set, use created 107 + } 108 + 105 109 const modified = coalesceAliases(data, [ 106 110 "modified", 107 111 "lastmod",
+10
quartz/plugins/transformers/lastmod.ts
··· 12 12 priority: ["frontmatter", "git", "filesystem"], 13 13 } 14 14 15 + // YYYY-MM-DD 16 + const iso8601DateOnlyRegex = /^\d{4}-\d{2}-\d{2}$/ 17 + 15 18 function coerceDate(fp: string, d: any): Date { 19 + // check ISO8601 date-only format 20 + // we treat this one as local midnight as the normal 21 + // js date ctor treats YYYY-MM-DD as UTC midnight 22 + if (typeof d === "string" && iso8601DateOnlyRegex.test(d)) { 23 + d = `${d}T00:00:00` 24 + } 25 + 16 26 const dt = new Date(d) 17 27 const invalidDate = isNaN(dt.getTime()) || dt.getTime() === 0 18 28 if (invalidDate && d !== undefined) {