Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Fix incorrect 'nice date' formatting. Closes #635.

Kailash Nadhb48a15cfa3fa
diff --git a/frontend/src/utils.js b/frontend/src/utils.js
index 89c35138..2a7652d3 100644
--- a/frontend/src/utils.js
+++ b/frontend/src/utils.js
@@ -32,13 +32,12 @@ export default class Utils {
return '';
}
- const d = new Date(stamp);
- const day = this.i18n.t(`globals.days.${(d.getDay())}`);
- const month = this.i18n.t(`globals.months.${(d.getMonth() + 1)}`);
- let out = `${day}, ${d.getDate()}`;
- out += ` ${month} ${d.getFullYear()}`;
+ const d = dayjs(stamp);
+ const day = this.i18n.t(`globals.days.${d.day()}`);
+ const month = this.i18n.t(`globals.months.${d.month() + 1}`);
+ let out = d.format(`[${day},] DD [${month}] YYYY`);
if (showTime) {
- out += ` ${d.getHours()}:${d.getMinutes()}`;
+ out += d.format(', HH:mm');
}
return out;