2

Evening, I really don't know how to convert this:

let birthDay = Calendar.current.date(era: 1, year: year, month: moth, day: day, hour: 0, minute: 0, second: 0, nanosecond: 0)

Into this:

Calendar.current.date(from: <DateComponents>)

Any tips?

This is what I did:

let dateComponet = DateComponents(timeZone: nil, era: 1, year: year, month: month, day: day, hour: 0, minute: 0, second: 0, nanosecond: 0)
let birthDay = Calendar.current.date(from: dateComponet)

Is there a shorter way?

Thanks

4

1 に答える 1