From 1f08239dd60c05f1eb6eb9b3122aa23cd700348b Mon Sep 17 00:00:00 2001
From: 杨锴 <841720330@qq.com>
Date: 星期三, 09 十月 2024 11:09:56 +0800
Subject: [PATCH] fix bug

---
 WanPai/Root/Other/View/CommonDatePickerView.swift |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/WanPai/Root/Other/View/CommonDatePickerView.swift b/WanPai/Root/Other/View/CommonDatePickerView.swift
index 3242f47..2c7c00f 100644
--- a/WanPai/Root/Other/View/CommonDatePickerView.swift
+++ b/WanPai/Root/Other/View/CommonDatePickerView.swift
@@ -183,8 +183,11 @@
 												switch type{
 																case .YMD:
 																				let year = years[pickerView.selectedRow(inComponent: 0)]
-																				let month = months[pickerView.selectedRow(inComponent: 1)]
+																				var month = months[pickerView.selectedRow(inComponent: 1)]
 
+																				if year == Date().jq_nowYear(){
+																								month = Date().jq_nowMonth() - pickerView.selectedRow(inComponent: 1)
+																				}
 																				if year == Date().jq_nowYear() && month == Date().jq_nowMonth(){
 																								return Date().jq_nowDay()
 																				}else{
@@ -221,8 +224,9 @@
 								if component == 1{
 												switch type{
 																case .YM,.YMD:
+																				let nowMonth = Date().jq_nowMonth()
 																				if pickerView.selectedRow(inComponent: 0) == 0{
-																								return "\(11 - Date().jq_nowMonth() - row - 1)月"
+																								return "\(nowMonth - row)月"
 																				}
 																				return "\(months[row])月"
 																case .HHmm:return String(format: "%02ld分", minutes[row])

--
Gitblit v1.7.1