Skip to content

Instantly share code, notes, and snippets.

@danielo515
Last active February 12, 2023 06:22
Show Gist options
  • Save danielo515/9356f1af0b642dd23f6cdc188d73d7be to your computer and use it in GitHub Desktop.
Save danielo515/9356f1af0b642dd23f6cdc188d73d7be to your computer and use it in GitHub Desktop.
// Name: today-timestamp
// Description: inserts the today date (not including time) formatted as YYYY/MM/DD
// Snippet: !tday
import '@johnlindquist/kit';
function twoDigits(number: number): string {
return number.toString().padStart(2, '0');
}
await hide();
const today = new Date();
// Format date to YYYY/MM/DD format
const formatted = `${today.getFullYear()}/${twoDigits(today.getMonth() + 1)}/${twoDigits(today.getDate())}`;
await keyboard.type(formatted);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment