File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -155,6 +155,11 @@ export class DateTimePicker extends DateTimePickerBase {
155
155
const context = options . context ;
156
156
let dateTime : Date ;
157
157
if ( value ) {
158
+ if ( nativePicker instanceof android . widget . DatePicker ) {
159
+ const minDate = ( < DatePickerOptions > options ) . minDate ;
160
+ const maxDate = ( < DatePickerOptions > options ) . maxDate ;
161
+ value = DateTimePicker . _trimDate ( value , minDate , maxDate ) ;
162
+ }
158
163
dateTime = new Date ( value . getTime ( ) ) ;
159
164
} else {
160
165
dateTime = ( nativePicker instanceof android . widget . DatePicker ) ? getDateToday ( ) : getDateNow ( ) ;
@@ -188,6 +193,17 @@ export class DateTimePicker extends DateTimePickerBase {
188
193
}
189
194
}
190
195
196
+ private static _trimDate ( originalDate : Date , minDate : Date , maxDate : Date ) {
197
+ let finalDate = originalDate ;
198
+ if ( minDate !== undefined && minDate > finalDate ) {
199
+ finalDate = minDate ;
200
+ }
201
+ if ( maxDate !== undefined && maxDate < finalDate ) {
202
+ finalDate = maxDate ;
203
+ }
204
+ return finalDate ;
205
+ }
206
+
191
207
private static _applyDialogColors ( nativeDialog : android . app . AlertDialog , color : Color , backgroundColor : Color ) {
192
208
if ( backgroundColor ) {
193
209
nativeDialog . getWindow ( ) . setBackgroundDrawable ( new android . graphics . drawable . ColorDrawable ( backgroundColor . android ) ) ;
You can’t perform that action at this time.
0 commit comments