diff --git a/app/soapbox/components/birth_date_input.js b/app/soapbox/components/birth_date_input.js index 3147c317e..b07c54515 100644 --- a/app/soapbox/components/birth_date_input.js +++ b/app/soapbox/components/birth_date_input.js @@ -34,18 +34,14 @@ class EditProfile extends ImmutablePureComponent { value: PropTypes.instanceOf(Date), }; - isDateValid = date => { - const { minAge } = this.props; - const allowedDate = new Date(); - allowedDate.setDate(allowedDate.getDate() - minAge); - return date && allowedDate.setHours(0, 0, 0, 0) >= new Date(date).setHours(0, 0, 0, 0); - } - render() { - const { intl, value, onChange, supportsBirthDates, hint, required } = this.props; + const { intl, value, onChange, supportsBirthDates, hint, required, minAge } = this.props; if (!supportsBirthDates) return null; + const maxDate = new Date(); + maxDate.setDate(maxDate.getDate() - minAge); + return (