File tree Expand file tree Collapse file tree 2 files changed +15
-19
lines changed
android/src/main/java/com/henninghall/date_picker Expand file tree Collapse file tree 2 files changed +15
-19
lines changed Original file line number Diff line number Diff line change 11package com .henninghall .date_picker ;
22
3- import android .util .Log ;
4-
53import com .facebook .react .bridge .Dynamic ;
64import com .henninghall .date_picker .models .Is24HourSource ;
75import com .henninghall .date_picker .models .Mode ;
@@ -97,11 +95,23 @@ public Locale getLocale() {
9795 }
9896
9997 public Calendar getMinimumDate () {
100- return Utils . isoToCalendar (minimumDateProp . getValue (), getTimeZone () );
98+ return boundaryPropToCal (minimumDateProp );
10199 }
102100
103101 public Calendar getMaximumDate () {
104- return Utils .isoToCalendar (maximumDateProp .getValue (), getTimeZone ());
102+ return boundaryPropToCal (maximumDateProp );
103+ }
104+
105+ private Calendar boundaryPropToCal (Prop <String > prop ){
106+ Calendar cal = Utils .isoToCalendar (prop .getValue (), getTimeZone ());
107+ clearSecondsAndMilliseconds (cal );
108+ return cal ;
109+ }
110+
111+ private void clearSecondsAndMilliseconds (Calendar cal ) {
112+ if (cal == null ) return ;
113+ cal .set (Calendar .SECOND , 0 );
114+ cal .set (Calendar .MILLISECOND , 0 );
105115 }
106116
107117 public TimeZone getTimeZone () {
Original file line number Diff line number Diff line change @@ -27,14 +27,7 @@ class DatePickerAndroid extends React.PureComponent {
2727
2828 if ( props . modal ) return null
2929
30- return (
31- < NativeComponent
32- { ...props }
33- maximumDate = { this . _withoutSecond ( props . maximumDate ) }
34- minimumDate = { this . _withoutSecond ( props . minimumDate ) }
35- onChange = { this . _onChange }
36- />
37- )
30+ return < NativeComponent { ...props } onChange = { this . _onChange } />
3831 }
3932
4033 getId = ( ) => {
@@ -117,13 +110,6 @@ class DatePickerAndroid extends React.PureComponent {
117110 this . isClosing = true
118111 this . props . onCancel ( )
119112 }
120-
121- _withoutSecond = ( date ) => {
122- if ( ! date ) return date
123- date . setSeconds ( 0 )
124- date . setMilliseconds ( 0 )
125- return date
126- }
127113}
128114
129115export default DatePickerAndroid
You can’t perform that action at this time.
0 commit comments