You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
let dc = DateComponents(hour: 5, minute: 2)
print(dc.value(for: .second))
/// The calendar and timeZone and isLeapMonth property values cannot be retrieved by this method.
public func value(for component: Calendar.Component) -> Int?
Returns: Optional(9223372036854775807) instead of nil
p.s. the whole "isLeapMonth" thing for EVERY DATE COMPONENTS is really annoying
The text was updated successfully, but these errors were encountered:
I debugged through the code and found that this issue happens for any component that you haven't explicitly given a value to. All values that should be nil seem to get replaced with the value of Int.max.
However this happens on both Mac and Linux it seems, so as far as I can tell it's expected behavior? Although it does seem somewhat strange, it would be nice to get input from Apple on this.
Attachment: Download
Environment
Xcode 8
Additional Detail from JIRA
md5: 0cfc50f542146fceb8eeb2f9d4156906
Issue Description:
let dc = DateComponents(hour: 5, minute: 2)
print(dc.value(for: .second))
/// The calendar and timeZone and isLeapMonth property values cannot be retrieved by this method.
public func value(for component: Calendar.Component) -> Int?
Returns: Optional(9223372036854775807) instead of nil
p.s. the whole "isLeapMonth" thing for EVERY DATE COMPONENTS is really annoying
The text was updated successfully, but these errors were encountered: