diff --git a/example-vault.zip b/example-vault.zip
index e7674ae..020f00a 100644
Binary files a/example-vault.zip and b/example-vault.zip differ
diff --git a/example-vault/rich-foot-example/.obsidian/plugins/rich-foot/main.js b/example-vault/rich-foot-example/.obsidian/plugins/rich-foot/main.js
index dd831e5..97d8e8e 100644
--- a/example-vault/rich-foot-example/.obsidian/plugins/rich-foot/main.js
+++ b/example-vault/rich-foot-example/.obsidian/plugins/rich-foot/main.js
@@ -107,7 +107,7 @@ var ReleaseNotesModal = class extends import_obsidian.Modal {
};
// virtual-module:virtual:release-notes
-var releaseNotes = '
\u{1F4C6} Dates Your Way
\nv1.7.1
\n\u{1F41B} Fixed
\n\n- Note embeds in canvas now have the correct height
\n- Duplicate "show dates" option in settings
\n
\nv1.7.0
\n\u2728 Added
\n\nCustom Created/Modified Date Property
fields to allow users to specify their own frontmatter properties for dates, useful when file system dates are affected by sync processes and you track them separately. \n
\n
\n';
+var releaseNotes = '\u{1F4C6} Dates Your Way
\nv1.7.1
\n\u{1F41B} Fixed
\n\n- Note embeds in canvas now have the correct height
\n- Duplicate "show dates" option in settings
\n
\n\u2728 Added
\n\n- If using custom created/modified date properties, the date now displays in the format of "Month Day, Year" if in proper date format, otherwise it displays the raw frontmatter filed string value.
\n
\nv1.7.0
\n\u2728 Added
\n\nCustom Created/Modified Date Property
fields to allow users to specify their own frontmatter properties for dates, useful when file system dates are affected by sync processes and you track them separately. \n
\n
\n';
// src/main.js
var DEFAULT_SETTINGS = {
@@ -168,6 +168,18 @@ var RichFootPlugin = class extends import_obsidian2.Plugin {
await this.checkVersion();
this.updateRichFoot = (0, import_obsidian2.debounce)(this.updateRichFoot.bind(this), 100, true);
this.addSettingTab(new RichFootSettingTab(this.app, this));
+ this.registerEvent(
+ this.app.metadataCache.on("changed", (file) => {
+ const cache = this.app.metadataCache.getFileCache(file);
+ if (cache == null ? void 0 : cache.frontmatter) {
+ const customCreatedProp = this.settings.customCreatedDateProp;
+ const customModifiedProp = this.settings.customModifiedDateProp;
+ if (customCreatedProp && customCreatedProp in cache.frontmatter || customModifiedProp && customModifiedProp in cache.frontmatter) {
+ this.updateRichFoot();
+ }
+ }
+ })
+ );
this.app.workspace.onLayoutReady(() => {
this.registerEvent(
this.app.workspace.on("layout-change", this.updateRichFoot)
@@ -342,6 +354,11 @@ var RichFootPlugin = class extends import_obsidian2.Plugin {
let modifiedDate;
if (this.settings.customModifiedDateProp && frontmatter && frontmatter[this.settings.customModifiedDateProp]) {
modifiedDate = frontmatter[this.settings.customModifiedDateProp];
+ if (!isNaN(Date.parse(modifiedDate))) {
+ const [year, month, day] = modifiedDate.split("-").map(Number);
+ const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
+ modifiedDate = `${months[month - 1]} ${day}, ${year}`;
+ }
} else {
modifiedDate = new Date(file.stat.mtime);
modifiedDate = `${modifiedDate.toLocaleString("default", { month: "long" })} ${modifiedDate.getDate()}, ${modifiedDate.getFullYear()}`;
@@ -353,6 +370,11 @@ var RichFootPlugin = class extends import_obsidian2.Plugin {
let createdDate;
if (this.settings.customCreatedDateProp && frontmatter && frontmatter[this.settings.customCreatedDateProp]) {
createdDate = frontmatter[this.settings.customCreatedDateProp];
+ if (!isNaN(Date.parse(createdDate))) {
+ const [year, month, day] = createdDate.split("-").map(Number);
+ const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
+ createdDate = `${months[month - 1]} ${day}, ${year}`;
+ }
} else {
createdDate = new Date(file.stat.ctime);
createdDate = `${createdDate.toLocaleString("default", { month: "long" })} ${createdDate.getDate()}, ${createdDate.getFullYear()}`;