@@ -92,6 +92,7 @@ class RangePickerController {
92
92
return one.year == two.year && one.month == two.month && one.day == two.day;
93
93
}
94
94
95
+ /// Returns whether the [date] is selectable or not. (i.e. if it is between the [minDate] and the [maxDate] )
95
96
/// Returns whether the [date] is selectable or not. (i.e. if it is between the [minDate] and the [maxDate] )
96
97
bool dateIsSelectable (DateTime date) {
97
98
for (final DateTime disabledDay in disabledDates) {
@@ -100,8 +101,23 @@ class RangePickerController {
100
101
}
101
102
}
102
103
103
- if (startDate != null && endDate == null ) {
104
- var dateDifference = date.difference (startDate! ).inDays;
104
+ DateTime tmpDate = date.toUtc ();
105
+ tmpDate = tmpDate.add (date.timeZoneOffset);
106
+
107
+ DateTime ? tmpStartDate;
108
+ DateTime ? tmpEndDate;
109
+
110
+ if (startDate != null ) {
111
+ tmpStartDate = startDate! .toUtc ();
112
+ tmpStartDate = tmpStartDate.add (startDate! .timeZoneOffset);
113
+ }
114
+ if (endDate != null ) {
115
+ tmpEndDate = endDate! .toUtc ();
116
+ tmpEndDate = tmpEndDate.add (endDate! .timeZoneOffset);
117
+ }
118
+
119
+ if (tmpStartDate != null && tmpEndDate == null ) {
120
+ var dateDifference = tmpDate.difference (tmpStartDate).inDays;
105
121
if (maximumDateRangeLength != null &&
106
122
dateDifference + 1 > maximumDateRangeLength! ) {
107
123
return false ;
@@ -114,10 +130,10 @@ class RangePickerController {
114
130
}
115
131
}
116
132
117
- if (minDate != null && date .isBefore (minDate! )) {
133
+ if (minDate != null && tmpDate .isBefore (minDate! )) {
118
134
return false ;
119
135
}
120
- if (maxDate != null && date .isAfter (maxDate! )) {
136
+ if (maxDate != null && tmpDate .isAfter (maxDate! )) {
121
137
return false ;
122
138
}
123
139
return true ;
0 commit comments