malcommac / SwiftDate

🐔 Toolkit to parse, validate, manipulate, compare and display dates, time & timezones in Swift.
MIT License
7.64k stars 770 forks source link

Added .asLocale() to String object to transform identifier in an NSLocale object #727

Closed kpostekk closed 4 years ago

kpostekk commented 4 years ago

Main purpose of this proposition is simplifying access for Locale obj while use of .toFormat() method.

Example of usage

Date().foFormat("HH:mm", locale: "pl".asLocale())
// instead of
Date().toFormat("HH:mm", locale: Locale(identifier: "pl"))