Skip to content

Commit cee1cd3

Browse files
committed
fix: use locale datetime on full dates
1 parent 2a8f7cf commit cee1cd3

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

web/src/main.js

+9-2
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,16 @@ Vue.filter('formatDate', (value) => {
4343
const now = moment();
4444

4545
if (now.isSame(date, 'day')) {
46-
return `${date.fromNow()} (${date.format('HH:mm')})`; // Display only time if today
46+
// Display only time if today
47+
return `${date.fromNow()} (${date.format('HH:mm')})`;
4748
}
48-
return date.format('L HH:mm'); // Display only date otherwise
49+
50+
const dateOptions = { year: 'numeric', month: '2-digit', day: '2-digit' };
51+
const timeOptions = { hour12: false, hour: '2-digit', minute: '2-digit' };
52+
const jsDate = date.toDate();
53+
54+
// Display only date otherwise
55+
return `${jsDate.toLocaleDateString(undefined, dateOptions)} ${jsDate.toLocaleTimeString(undefined, timeOptions)}`;
4956
});
5057
Vue.filter('formatTime', (value) => (value ? moment(String(value)).format('LTS') : '—'));
5158
Vue.filter('formatLog', (value) => (value ? convert.ansi_to_html(String(value)) : value));

0 commit comments

Comments
 (0)