Skip to content

Commit

Permalink
Merge pull request Expensify#13702 from Expensify/cmartins-fixDatePicker
Browse files Browse the repository at this point in the history
Allow future dates to be entered in DatePicker
  • Loading branch information
luacmartins authored Dec 19, 2022
2 parents a73678d + 4f2ef4c commit 9a52f02
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 12 deletions.
4 changes: 0 additions & 4 deletions src/components/DatePicker/datepickerPropTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ const propTypes = {
* `onInputChange` would always be called with a Date (or null)
*/
defaultValue: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.string]),

/* Restricts for selectable max date range for the picker */
maximumDate: PropTypes.instanceOf(Date),
};

const defaultProps = {
...defaultFieldPropTypes,
value: undefined,
maximumDate: undefined,
};

export {propTypes, defaultProps};
1 change: 0 additions & 1 deletion src/components/DatePicker/index.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ class DatePicker extends React.Component {
value={this.props.value || this.props.defaultValue ? moment(this.props.value || this.props.defaultValue).toDate() : new Date()}
mode="date"
onChange={this.setDate}
maximumDate={this.props.maximumDate}
/>
)}
</>
Expand Down
1 change: 0 additions & 1 deletion src/components/DatePicker/index.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ class DatePicker extends React.Component {
themeVariant="dark"
onChange={this.updateLocalDate}
locale={this.props.preferredLocale}
maximumDate={this.props.maximumDate}
/>
</Popover>
</>
Expand Down
3 changes: 0 additions & 3 deletions src/components/DatePicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ class DatePicker extends React.Component {
// Adds nice native datepicker on web/desktop. Not possible to set this through props
this.inputRef.setAttribute('type', 'date');
this.inputRef.classList.add('expensify-datepicker');
if (this.props.maximumDate) {
this.inputRef.setAttribute('max', moment(this.props.maximumDate).format(CONST.DATE.MOMENT_FORMAT_STRING));
}
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/pages/EnablePayments/AdditionalDetailsStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,6 @@ class AdditionalDetailsStep extends React.Component {
defaultValue={this.props.walletAdditionalDetailsDraft.dob || ''}
placeholder={this.props.translate('common.dob')}
errorText={this.getErrorText('dob') || this.getErrorText('age')}
maximumDate={new Date()}
/>
<TextInput
containerStyles={[styles.mt4]}
Expand Down
1 change: 0 additions & 1 deletion src/pages/ReimbursementAccount/CompanyStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,6 @@ class CompanyStep extends React.Component {
inputID="incorporationDate"
label={this.props.translate('companyStep.incorporationDate')}
placeholder={this.props.translate('companyStep.incorporationDatePlaceholder')}
maximumDate={new Date()}
defaultValue={ReimbursementAccountUtils.getDefaultStateForField(this.props, 'incorporationDate')}
shouldSaveDraft
/>
Expand Down
1 change: 0 additions & 1 deletion src/pages/ReimbursementAccount/IdentityForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,6 @@ const IdentityForm = (props) => {
defaultValue={props.values.dob || props.defaultValues.dob}
onInputChange={value => props.onFieldChange({dob: value})}
errorText={dobErrorText}
maximumDate={new Date()}
/>
<TextInput
inputID={props.inputKeys.ssnLast4}
Expand Down

0 comments on commit 9a52f02

Please sign in to comment.