jobisoft / quicktext

An extension for Thunderbird that lets you create templates that can be easily inserted into your own emails.
Mozilla Public License 2.0
187 stars 53 forks source link

Input date as ISO8601 #389

Open LukasCBossert opened 1 year ago

LukasCBossert commented 1 year ago

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 commented 1 year ago

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.