Hi, how do I edit the meeting notes template so th...
# questions
m
Hi, how do I edit the meeting notes template so that the title is the full 'yyyy-mm-dd' date, rather than just 'dd'?
j
Hey @muteboy , the title of a note is not altered by template or schema currently. Although you could create a note-trait for meeting notes and use
Create Note With Custom Trait
to create a meeting note. Quickstart for custom note traits: https://wiki.dendron.so/notes/EQoaBI8A0ZcswKQC3UMpO/ Here's a quick note trait I wrote. You can run
Dendron: Register Note Trait
and paste this into the file. I called the custom trait meeting-note.
Copy code
/**
 * Note: you must reload your window after each file change for it to take into
 * effect. We are working to improve this behavior.
 */
module.exports = {
  /**
   * Specify behavior to modify the name of the note. If
   * promptUserForModification is true, the modified name will appear in a
   * lookup control to allow the user to further edit the note name before
   * confirming.
   */
  OnWillCreate: {
    setNameModifier(props) {
      const curDate = new Date();
      const year = curDate.getFullYear();
      const month = String(curDate.getMonth() + 1).padStart(2, "0");
      const date = String(curDate.getDate());
      return {
        name: ["meet",year,month,date].join('.'),
        promptUserForModification: true
      };
    }
  },
   /**
   * Specify behavior for altering the title of the note when it is created.
   */
    OnCreate: {
      setTitle(props) {
        const curDate = new Date();
        const year = curDate.getFullYear();
        const month = String(curDate.getMonth() + 1).padStart(2, "0");
        const date = String(curDate.getDate());
        const title = [year,month,date].join('-');
        return title;
      }
    }
}
Hey @shchepin, you could also give the custom note trait a try and use
Create Note With Custom Trait
command to create notes. The instructions to add the custom traits are the same as above, you can use something like the below snippet to alter the title
Copy code
/**
 * Note: you must reload your window after each file change for it to take into
 * effect. We are working to improve this behavior.
 */
 module.exports = {
  /**
  * Specify behavior for altering the title of the note when it is created.
  */
   OnCreate: {
     setTitle(props) {
       const curDate = new Date();
       const year = curDate.getFullYear();
       const month = String(curDate.getMonth() + 1).padStart(2, "0");
       const date = String(curDate.getDate());
       const title = [year,month,date].join('-');
       return title;
     }
   }
}
4 Views