更改日历从今天开始的日期?

时间:2019-12-03 08:20:35

标签: ios swift xcode filter calendar

您好,我在项目中工作,我们将日历中的日期过滤到10年后 从10年开始打开压光机

我要在打开日历时从当前日期开始

let group: [UIButton] = [filterOne, filterThree, filterTwo]
group.forEach { item in
    item.backgroundColor = .primaryButtonColor
    item.layer.cornerRadius = 15
}
dateRangePickerViewController.delegate = self
dateRangePickerViewController.minimumDate = Calendar.current.date(byAdding: .year, value: -10, to: Date())

dateRangePickerViewController.maximumDate = Calendar.current.date(byAdding: .year, value: 1, to: Date())
// dateRangePickerViewController.selectedStartCell = Calendar
dateRangePickerViewController.selectedStartDate = Date()
dateRangePickerViewController.selectedEndDate = Calendar.current.date(byAdding: .day, value: 1, to: Date())
self.startDate = Date()
self.endDate = Calendar.current.date(byAdding: .day, value: 1, to: Date())
fromValue.text = self.startDate?.toString(format: "yyyy/MM/dd")
fromValue.text = self.endDate?.toString(format: "yyyy/MM/dd")

calender

0 个答案:

没有答案