Skip to content

Commit

Permalink
Fix incorrect 'nice date' formatting. Closes #635.
Browse files Browse the repository at this point in the history
  • Loading branch information
knadh committed Dec 27, 2021
1 parent e982e6b commit b48a15c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions frontend/src/utils.js
Expand Up @@ -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;
Expand Down

0 comments on commit b48a15c

Please sign in to comment.