1

I have one usecase, where i (while applying one of templates) input the needed date and then use it... tp.date.now() does not suit me and i decided to do it manually

insertDate js

async function insertDate(tp) {
    const mmnt = await tp.system.prompt("Enter the date (YYYY-MM-DD):");
    tp.insertedDate = mmnt;
}

module.exports = insertDate;

manualDate js

async function manualDate(tp,format) {
    const storedDate = tp.store.get("manualDate");
    if (storedDate) {
        const mmnt = moment(storedDate);
        return mmnt.format(format);
    }
}

module.exports = manualDate;

this template gives error

    <% tp.user.insertDate(tp) %>

    <% tp.user.manualDate("DD MMM YYYY, dddd") %>

i understand that insertDate has no time for saving the manually entered date in order to give it further to manualDate script. How can i solve this?

ChatGPT gave me this

     tp.user.insertDate(tp).then(() => { return tp.user.manualDate("DD MMM YYYY, dddd"); }) 

but it still gives an error - and, by the way, i haven't found the way to access the console log of Obsidian (v 1.3.5) - no manual helped

tegowai
  • 81
  • 1
  • 1
  • 8

0 Answers0