Skip to content

Commit 03e0697

Browse files
authored
增加起始时间时分秒控制
1 parent 8c7c7ff commit 03e0697

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pickerview/src/main/java/com/bigkoo/pickerview/view/TimePickerView.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,8 +195,10 @@ private void initDefaultSelectedDate() {
195195
private void setTime() {
196196
int year, month, day, hours, minute, seconds;
197197
Calendar calendar = Calendar.getInstance();
198-
Log.i("TAG", "===> " + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(calendar.getTime()));
199198
boolean isInRange = true;
199+
if (mPickerOptions.date != null) {
200+
calendar.setTime(mPickerOptions.date.getTime());
201+
}
200202
if (mPickerOptions.startDate != null && mPickerOptions.endDate != null) {
201203
if (calendar.getTimeInMillis() < mPickerOptions.startDate.getTimeInMillis()
202204
|| calendar.getTimeInMillis() > mPickerOptions.endDate.getTimeInMillis()) {
@@ -214,6 +216,7 @@ private void setTime() {
214216
calendar = mPickerOptions.endDate;
215217
}
216218
}
219+
217220
if (!isInRange) {
218221
year = calendar.get(Calendar.YEAR);
219222
month = calendar.get(Calendar.MONTH);

0 commit comments

Comments
 (0)