JavaScript is honestly one of the most powerful and versatile languages. It can be run anywhere and has a lot of built-in methods that make building logic a breeze. When you know about them that is. Today, we’re going to be highlighting some cool functionality relating to time. This being Intl.DateTimeFormat.

For Intl.DateTimeFormat, this constructor provides consistent translation of time-based on the region you specify.

const date = new Date('12/15/2022');

new Intl.DateTimeFormat('en-US').format(date)
// 12/12/2022
new Intl.DateTimeFormat('FR').format(date)
// 15/12/2022