1
0
silverbullet/packages/plugs/core/dates.ts
2022-10-07 00:04:12 +02:00

12 lines
248 B
TypeScript

export function niceDate(d: Date): string {
function pad(n: number) {
let s = String(n);
if (s.length === 1) {
s = '0' + s;
}
return s;
}
return d.getFullYear() + '-' + pad(d.getMonth() + 1) + '-' + pad(d.getDate())
}