Skip to content

Instantly share code, notes, and snippets.

function zeroPad(num: number, count: number, radix: number = 10): string {
if (num < 0) return "-" + zeroPad(-num, count, radix);
const str = (num | 0).toString(radix);
if (str.length > count) return str;
return ("0".repeat(count) + str).substr(-count);
}
function formatDate(date: Date) {
return zeroPad(date.getFullYear(), 4) + "-" + zeroPad(date.getMonth()+1, 2) + "-" + zeroPad(date.getDate(), 2)
}

Keybase proof

I hereby claim:

  • I am digitalbias on github.
  • I am digitalbias (https://keybase.io/digitalbias) on keybase.
  • I have a public key whose fingerprint is 8797 59FB 81C0 FC66 5213 877B 1C3F 6F24 2652 5289

To claim this, I am signing this object: