Action Directory / Insert Date

Install

Shared by nickchristensen

Script

let leftPad = (digit) => {
	let str = digit.toString()
	return digit >=10 ? str : 0 + str;
}

let date = new Date()
let year = leftPad(date.getFullYear() % 100)
let month = leftPad(date.getMonth() + 1)
let day = leftPad(date.getDate())
editor.replaceSelection(`${year}-${month}-${day}`)