Prevent nil when using the 12 hour clock
Prevent nil when using the 12 hour clock

When you switch the device to the 12 hour clock (general > date & time > 24 hour slide), this method will return nil when the HH is greater than 12.
This is fixed when you set the locale. Since the format is specific, we're using en_US_POSIX.

More about the en_US_POSIX: https://developer.apple.com/library/ios/qa/qa1480/_index.html

Similar issue: http://stackoverflow.com/questions/20965129/date-formatting-returns-null
tomlokhorst/swift-json-gen,tomlokhorst/swift-json-gen,tomlokhorst/swift-json-gen