diff --git a/web/src/message_edit_history.js b/web/src/message_edit_history.js index ae12f4eb04..0c988b5323 100644 --- a/web/src/message_edit_history.js +++ b/web/src/message_edit_history.js @@ -1,4 +1,4 @@ -import {format, isSameDay} from "date-fns"; +import {isSameDay} from "date-fns"; import $ from "jquery"; import render_message_edit_history from "../templates/message_edit_history.hbs"; @@ -16,6 +16,7 @@ import * as spectators from "./spectators"; import * as sub_store from "./sub_store"; import * as timerender from "./timerender"; import * as ui_report from "./ui_report"; +import {user_settings} from "./user_settings"; export function fetch_and_render_message_history(message) { channel.get({ @@ -26,12 +27,15 @@ export function fetch_and_render_message_history(message) { let prev_time = null; let prev_stream_item = null; + const date_time_format = new Intl.DateTimeFormat(user_settings.default_language, { + dateStyle: "long", + }); for (const [index, msg] of data.message_history.entries()) { // Format times and dates nicely for display const time = new Date(msg.timestamp * 1000); const item = { timestamp: timerender.stringify_time(time), - display_date: format(time, "MMMM d, yyyy"), + display_date: date_time_format.format(time), show_date_row: prev_time === null || !isSameDay(time, prev_time), };