All my notes have a frontmatter property called ‘modified’ that automatically updates to the date and time the note has been modified last by using the Front Matter Timestamps community plugin. The property type is text and the format it shows is ‘DD-MM-YYYY, HH:mm’.
My Daily Notes all have the default file name format: YYYY-MM-DD.
In my Daily Notes template, I want to include a Base that shows all notes that were modified on the day of the Daily Note that is open.
This means that I need to match the file name with the modified property.
I’m not sure how I can do this, I’ve tried some ways but have yet to succeed.
Anyone know a way I can achieve this?
Btw, I don’t fancy using the file.mtime property, since file.mtime thinks that opening a note is already modifying it and I just don’t agree with that. It differs from the modified property that the Front Matter Timestamps plugin creates, as that plugin only modifies the modified property when there has actually been any modification.
With the conditions you specified, you can accomplish this by:
Creating a formula in the Base that parses the modified attribute with RegExp, outputting only the year, month, and day (YYYY-MM-DD), and parsing the result using the date function
That being said, you could avoid the formula altogether if the modified field used the built-in “Date & time” property type. If that were the case, the Base could be simplified to simply:
It’s the same principle as michaelrfowler’s suggestion but possibly a bit more manageable and more efficient. It tells the base to view the file name as a date and then make that date look like the first 10 characters of your ‘modified’ property. No additional formula needed.
Hi dawni, I have 1 more request. Besides daily notes I also have weekly notes. In these weekly notes I also want to have a Bases embed of the created notes in that week and the last modified notes in that week. The weekly notes file name format is YYYY-[W]WW.
I’ve managed to make the filter for the created notes in that week work like this: date(created).format(“YYYY-[W]WW”) == this.file.name
I’ve unfortunately not managed to make the filter for the last modified notes in that week work. I have tried some things but none of them work, although I understand I can’t use the same logic as in your solution:
modified.slice(0,10) == date(this.file.name).format(“YYYY-[W]WW”)
date(modified.slice(0,10)).format(“YYYY-[W]WW”) == this.file.name
date(modified.slice(0,10)).format(“YYYY-[W]WW”) == date(this.file.name).format(“YYYY-[W]WW”)
It constructs a valid date from modified (with three slices joined by hyphens) then turns that into a string with the same format as your weekly note so they can be compared.
It works! I thínk I understand what it’s doing, first deconstructing the modified property into the 3 values day/month/year, putting that into a format with a hyphen so there is a proper date format. And thén converting it to the format we want and comparing it to the file name.
Again, I wouldn’t have been able to do this without any proper examples, so thanks a lot once again!