jsynowiec / vscode-insertdatestring

An extension for Visual Studio Code that provides a configurable command for inserting the current date and time
MIT License
63 stars 14 forks source link

Can I add custom text?? #23

Closed asrahi closed 2 years ago

asrahi commented 2 years ago

Thank you your extension, this is very useful!! Thank you!

I wanna insert DateTime + custom text; for ex) 2021-11-10 12:32:45 by ABCD

so I've tried this in my settings.json.

"insertDateString.format": "YYYY-MM-DD hh:mm:ss by ABCD" "insertDateString.format": "YYYY-MM-DD hh:mm:ss \b\y \A\B\C\D" "insertDateString.format": "YYYY-MM-DD hh:mm:ss \b\y \A\B\C\D"

how can I add custom text with datetime?

thank you

jsynowiec commented 2 years ago

You can probably use one of the extensions that let you record and play macros or use OS-level automation or some text expander application. Or you could create your extension for that.

swgn commented 8 months ago

I had a similar issue, I wanted to add a stamp in the format 2024W10 - 2024-03-04 (Note the "W" character in there).

"insertDateString.formatDate": "o'W'W - YYYY-MM-DD",

Solution is to enclose custom text within single quotes. Not sure if this "feature" is intentional or not, however for the moment it works.

For your specific case ^^, this works for me:

"insertDateString.format": "YYYY-MM-DD hh:mm:ss 'by ABCD'"
asrahi commented 8 months ago

I had a similar issue, I wanted to add a stamp in the format 2024W10 - 2024-02-03 (Note the "W" character in there).

"insertDateString.formatDate": "o'W'W - YYYY-MM-DD",

Solution is to enclose custom text within single quotes. Not sure if this "feature" is intentional or not, however for the moment it works.

For your specific case ^^, this works for me:

"insertDateString.format": "YYYY-MM-DD hh:mm:ss 'by ABCD'"

It works really well for me too!! Thank you so much!!