Calendar.dateComponents(in: TimeZone, from: Date) returns bad .quarter, unusable with UNCalendarNotificationTrigger(dateMatching:repeats:)

Number:rdar://35247464 Date Originated:30/10/2017
Status: Resolved:
Product:Foundation Product Version:Swift 3
Classification: Reproducible:
Root cause: Calendar.dateComponents(in: TimeZone, from: Date) returns components with a .quarter value of 0 regardless of which quarter the date value lies in.
Flow-on effect: a user notification scheduled to these components with UNCalendarNotificationTrigger(dateMatching:repeats:) fails to trigger.

Steps to Reproduce:
Root cause:
        // On a date not in the first quarter of the year:
        var components = Calendar.current.dateComponents(in: TimeZone.current, from: Date().addingTimeInterval(15)) // see below for calendar, timezone etc settings
        // inspect components.quarter: returns 0

Flow-on effect:
        // these are needed for for presumably unrelated reasons
        // (unlike .quarter, the values I see look reasonable)
        components.weekday = nil
        components.weekdayOrdinal = nil
        components.weekOfMonth = nil
        components.weekOfYear = nil
        components.yearForWeekOfYear = nil
        let trigger = UNCalendarNotificationTrigger(dateMatching: components, repeats: false)
        let content = UNMutableNotificationContent()
        content.title = "Message!"
        content.body = "Message body"
        let request = UNNotificationRequest(identifier: "request-identifier", content: content, trigger: trigger)
        UNUserNotificationCenter.current().add(request, withCompletionHandler: nil)

Expected Results:
Root cause: components.quarter != 0
Flow-on effect: user notification scheduled and triggers.

Actual Results:
Root cause: components.quarter == 0
Flow-on effect: user notification never triggers. It can be made to trigger by setting components.quarter to the correct value, which shows the notification-scheduling issue is directly caused by this bug.

Xcode Version 8.3.3 (8E3004b)
iOS simulator, iOS version 10.3.1 (14E8301)

I don't know how many of these are needed to reproduce:
* Calendar .gregorian
* Timezone "Europe/Athens"
* Date 30 October 2017 (presumably anything outside of the first quarter will do)


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!