Skip to content

Commit 7d97b90

Browse files
committed
fix: use locale datetime on full dates
1 parent c1b6ddc commit 7d97b90

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
@@ -45,9 +45,16 @@ Vue.filter('formatDate', (value) => {
4545
const now = moment();
4646

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

0 commit comments

Comments
 (0)