File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -155,6 +155,11 @@ export class DateTimePicker extends DateTimePickerBase {
155155 const context = options . context ;
156156 let dateTime : Date ;
157157 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+ }
158163 dateTime = new Date ( value . getTime ( ) ) ;
159164 } else {
160165 dateTime = ( nativePicker instanceof android . widget . DatePicker ) ? getDateToday ( ) : getDateNow ( ) ;
@@ -188,6 +193,17 @@ export class DateTimePicker extends DateTimePickerBase {
188193 }
189194 }
190195
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+
191207 private static _applyDialogColors ( nativeDialog : android . app . AlertDialog , color : Color , backgroundColor : Color ) {
192208 if ( backgroundColor ) {
193209 nativeDialog . getWindow ( ) . setBackgroundDrawable ( new android . graphics . drawable . ColorDrawable ( backgroundColor . android ) ) ;
You can’t perform that action at this time.
0 commit comments