Thanks for your help.
I tried the code you provided above, but I got this error in the latest Developer Edition -
SyntaxError: expected expression, got keyword 'var'
(background.js line 2)
Was there something else missing there after the const…?
Because of that error though, I removed the first line in your background.js example and it did log the date to the console, which made me realise that my code was actually like -
window is not from the right context.
new Intl.DateTimeFormat does work fine.
I also tried using
window.wrappedJSObject.Intl though; it fixed the previous error, but threw this one -
Permission denied to access property "weekday".
weekday is a property in the data format object I pass in for the date.