fix DateTimeToLocalizedStringTransformer issue #7561

this PR fix #7561 issue:

This fix possible issue with new `\DateTime` throwing `Exception` not handled by the transformer.