Skip to content

Commit e63a2e5

Browse files
committed
bug修改
1 parent 45d0686 commit e63a2e5

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

app/src/main/java/com/github2136/datalevelpicker_demo/MainActivity.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class MainActivity : AppCompatActivity() {
120120
}
121121
R.id.btn10 -> {
122122
timeRangPickerDialog.setLimit("07:00", "21:00")
123-
timeRangPickerDialog.show("12:00", "13:00", supportFragmentManager)
123+
timeRangPickerDialog.show(null, null, supportFragmentManager)
124124
}
125125
R.id.btn11 -> {
126126
dateTimePickerDialog.setLimit(null, null)

library/src/main/java/com/github2136/datetime/TimePickerDialog.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,9 @@ class TimePickerDialog(
126126
fun show(date: String?, manager: FragmentManager) {
127127
if (!this.isAdded) {
128128
val temp = if (date != null) {
129-
Util.str2date(date, Util.DATE_PATTERN_HM) ?: Date()
129+
Util.str2date(date, Util.DATE_PATTERN_HM) ?: Util.str2date(Util.date2str(Date(), Util.DATE_PATTERN_HM), Util.DATE_PATTERN_HM)!!
130130
} else {
131-
Date()
131+
Util.str2date(Util.date2str(Date(), Util.DATE_PATTERN_HM), Util.DATE_PATTERN_HM)!!
132132
}
133133
if (temp.before(startLimitCalendar.time) || temp.after(endLimitCalendar.time)) {
134134
timeCalender.time = startLimitCalendar.time

library/src/main/java/com/github2136/datetime/TimeRangPickerDialog.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,9 @@ class TimeRangPickerDialog(
196196
}
197197
}
198198
val startTemp = if (start != null) {
199-
Util.str2date(start, Util.DATE_PATTERN_HM) ?: Date()
199+
Util.str2date(start, Util.DATE_PATTERN_HM) ?: Util.str2date(Util.date2str(Date(), Util.DATE_PATTERN_HM), Util.DATE_PATTERN_HM)!!
200200
} else {
201-
Date()
201+
Util.str2date(Util.date2str(Date(), Util.DATE_PATTERN_HM), Util.DATE_PATTERN_HM)!!
202202
}
203203
if (startTemp.before(startLimitCalendar.time) || startTemp.after(endLimitCalendar.time)) {
204204
startCalendar.time = startLimitCalendar.time
@@ -207,9 +207,9 @@ class TimeRangPickerDialog(
207207
}
208208

209209
val endTemp = if (end != null) {
210-
Util.str2date(end, Util.DATE_PATTERN_HM) ?: Date()
210+
Util.str2date(end, Util.DATE_PATTERN_HM) ?: Util.str2date(Util.date2str(Date(), Util.DATE_PATTERN_HM), Util.DATE_PATTERN_HM)!!
211211
} else {
212-
Date()
212+
Util.str2date(Util.date2str(Date(), Util.DATE_PATTERN_HM), Util.DATE_PATTERN_HM)!!
213213
}
214214
if (endTemp.before(startLimitCalendar.time) || endTemp.after(endLimitCalendar.time)) {
215215
endCalendar.time = startLimitCalendar.time

0 commit comments

Comments
 (0)