"Calendar.date(bySetting component: Calendar.Component, value: Int, of date: Date)" always fails when setting year prior than current date year

Originator:Schaeffer.Peter9
Number:rdar://45808216 Date Originated:05-Nov-2018 05:42 PM
Status:Open Resolved:
Product:iOS + SDK Product Version:12.0 / 12.1
Classification:Serious Bug Reproducible:Always
 
Summary:
When using  Calendar.date(bySetting component: Calendar.Component, value: Int, of date: Date), if the new year value is lower than the one currently set as year, the method always returns nil

Steps to Reproduce:
see the linked playground
1. Get the date year
2. Set year + 1 to the date -> it’s working
3. Set year - 1, it’s always returning nil, whatever the date 

Expected Results:
Setting year to a previous year using this method should return a valid date

Actual Results:
Setting year to a previous year using this method always return nil

Version:
12.0 / 12.1

Notes:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com 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!