1
0
silverbullet/plugs/core/dates.ts

12 lines
248 B
TypeScript
Raw Normal View History

2022-04-11 18:34:09 +00:00
export function niceDate(d: Date): string {
2022-10-06 22:04:12 +00:00
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())
2022-04-11 18:34:09 +00:00
}