Swift NSDate 获取当前日期但去除年、月和日

Swift NSDate get current date but strip Year, Month, and Day

我正在尝试使用 swift 获取当前日期。我已经处理好了,但它得到了年月日,我真的只想要当前的小时和分钟。原因是我稍后要比较只有一小时和一分钟的创建日期。我目前正在使用这个

let currentDate = NSDate()

谢谢

let calendar = Calendar.autoupdatingCurrent
let components = calendar.dateComponents([.hour, .minute], from: Date())
let hour = components.hour
let minute = components.minute