What potential pitfalls should be considered when using the IntlDateFormatter class in PHP for international date formatting?

When using the IntlDateFormatter class in PHP for international date formatting, one potential pitfall to consider is the need to handle different date formats and locales correctly. It is important to ensure that the input dates are in the correct format and that the desired locale is set appropriately to avoid unexpected results. Additionally, be mindful of any potential errors that may occur during date formatting and handle them gracefully to prevent any disruptions in the application.

// Example of setting the correct date format and locale when using IntlDateFormatter
$date = new DateTime('2022-01-15');
$locale = 'en_US'; // Set the desired locale
$formatter = new IntlDateFormatter($locale, IntlDateFormatter::MEDIUM, IntlDateFormatter::NONE);
echo $formatter->format($date);