Calendar locale

Hello, when using locale:‘hr-HR’, days are displayed like 1. 2. 3. (number and dot), like you can see on image - why is that and how to remove dot?
Thank you.


This is how browser Intl handles it, try it in console:

new Intl.DateTimeFormat('hr-HR', { day: 'numeric' }).format(new Date());

I try this:

const date = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
console.log(new Intl.DateTimeFormat(‘en-GB’).format(date));
console.log(new Intl.DateTimeFormat(‘hr-HR’).format(date));

and console display 20/12/2012 for GB (which is correct) but for HR it display
20. 12. 2012.
which is incorrect.
Correct value is 20.12.2012
(no spaces after dots, no dot at end).
Is this a Intl bug?

I found that this works OK:
var date1 = new Date(Date.UTC(2012, 11, 20, 3, 0, 0));
console.log(new Intl.DateTimeFormat(‘de-EN’).format(date1));
but if I use ‘de’ as locale, then I have german months and that’s bad.
How to display 20.12.2012 correctly usng HR locale, please?

Use en locale and specify custom day/month names in this parameters:

1 Like

Thank you, it works like that.