Angular: how to change the default locale translation of certain month name?

473 Views Asked by At

We use two locales in our project: russian and kazakh. For displaying dates we use angular's default datePipe. The word June in kazakh is "маусым" and it's shortened version is "мау". The short version confuses some of our users, because it's similar to english word "May".

So the question is "How to change the default locale translation "мау" to "маус" in Angular?". We can change it right in the node_modules folder, but it's not a clean solution. I think it's not recommended to change the vendor file after every build of the project.

1

There are 1 best solutions below

0
On

The default format used by the date pipe is mediumDate. The actual format looks like this: MMM d, y. If you want your months to be abbreviated with 4 letters, you should use the longDate format.

<div>{{myDate | date:'longDate'}}</div>

If you also need to display the time part, then you can use another format from the predefined ones, or even create a custom format following the instructions in the link above.