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) {
|
2022-10-12 09:47:13 +00:00
|
|
|
s = "0" + s;
|
2022-10-06 22:04:12 +00:00
|
|
|
}
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2022-10-12 09:47:13 +00:00
|
|
|
return d.getFullYear() + "-" + pad(d.getMonth() + 1) + "-" + pad(d.getDate());
|
2022-04-11 18:34:09 +00:00
|
|
|
}
|