Embedded comments dates are still not localized

Hi,

this topic is based on a discussion on ask.discourse.com, where we noticed what appears to be the same issue as in this older Meta topic:

Embed: dates are not localized

We are using the default Discourse embedded comments setup as documented here, without any special customization of the embed output:

Embed Discourse comments on another website via Javascript

I tried the new fullApp method and it had finnish dates but I like the older approach here better for this site.

What we see

The embedded comments UI is localized correctly, but the post date text is still shown in English.

For example, in the embed we may see:

April 2025

and the tooltip/title contains an English date/time such as:

April 9, 2025, 3.31pm

Expected behavior

The embedded comment dates should follow the site or user locale instead of always appearing in English.

In our case, we would expect Finnish-localized date formatting in the default embed.

Dirty workaround

With help of Claude I did quite dirty workaround using custom component and added javascript to embedded_header section - I already had some css based on if the class is normal (discourse-upotus) or dark (discourse-upotus-tumma).

<script type="text/javascript">
const selector = '.discourse-upotus a.post-date, .discourse-upotus-tumma a.post-date';

document.querySelectorAll(selector).forEach(el => {
  const title = el.getAttribute('title');
  if (!title) return;

  const match = title.match(/(\w+) (\d+), (\d{4}),\s*([\d]+)\.([\d]+)(am|pm)/i);
  if (!match) return;

  const [, month, day, year, hours, minutes, ampm] = match;
  const date = new Date(`${month} ${day}, ${year}`);
  if (isNaN(date)) return;

  let h = parseInt(hours);
  if (ampm.toLowerCase() === 'pm' && h !== 12) h += 12;
  if (ampm.toLowerCase() === 'am' && h === 12) h = 0;
  date.setHours(h, parseInt(minutes));

  const pvm = date.toLocaleDateString('fi-FI', { day: 'numeric', month: 'long', year: 'numeric' });
  const klo = date.toLocaleTimeString('fi-FI', { hour: '2-digit', minute: '2-digit' });

  el.textContent = pvm;
  el.setAttribute('title', `${pvm} klo ${klo}`);
});
</script>

Notes

  • this happens with the standard/default embed
  • no custom date formatting logic was added originally
  • we are referring specifically to the date output inside the embedded comments iframe
  • running latest and greatest Discourse

Could someone confirm whether this is still a known issue, and whether there is already a newer fix or related topic for it?

Thanks!