quicktext icon indicating copy to clipboard operation
quicktext copied to clipboard

Input date as ISO8601

Open LukasCBossert opened this issue 2 years ago • 1 comments

I am currently diving into quicktext and like a lot! Thanks for maintaining and developing it! My usecase makes it necessary to insert a date in the form of YYYY-MM-DD. I couldn’t find this as an option, only [[DATE=long]] .

I guess this could be done using a script, but I have no clue about javascript.

LukasCBossert avatar Nov 16 '23 19:11 LukasCBossert

Ok, after I send this issue I had the enlightment and ask chatGPT for help:

  const currentDate = new Date();
  const year = currentDate.getFullYear();
  const month = (currentDate.getMonth() + 1).toString().padStart(2, '0');
  const day = currentDate.getDate().toString().padStart(2, '0');

  const isoDate = `${year}-${month}-${day}`;
  return isoDate;

this creates YYYY-MM-DD of the current day. Proof that quicktext ist easy to use also for non-programmers.

LukasCBossert avatar Nov 16 '23 19:11 LukasCBossert