我有一个简单的问题:
func findWeekNumber(day: Int, month: Int, year: Int) {
var calendar = Calendar.current
var newEventComponents = DateComponents()
newEventComponents.day = day
newEventComponents.month = month
newEventComponents.year = year
var newEventDate = calendar.date(from: newEventComponents)
var newEventWeekNumber = calendar.dateComponents([.weekOfYear], from: newEventDate!)
var weeknumber = newEventWeekNumber.weekOfYear!
print("The date lies in week: \(weeknumber)")
}
findWeekNumber(day: 30, month: 12, year: 2020)
这会打印1,但应该是53。我在做什么错或者是错误?