Bluesky app fork with some witchin' additions 💫
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

set minimum birthday to 13 years ago (#7808)

authored by

Samuel Newman and committed by
GitHub
fff62516 5d30111b

+13 -1
+2 -1
src/components/dialogs/BirthDateSettings.tsx
··· 4 4 import {useLingui} from '@lingui/react' 5 5 6 6 import {cleanError} from '#/lib/strings/errors' 7 + import {getDateAgo} from '#/lib/strings/time' 7 8 import {logger} from '#/logger' 8 9 import {isIOS, isWeb} from '#/platform/detection' 9 10 import { ··· 101 102 onChangeDate={newDate => setDate(new Date(newDate))} 102 103 label={_(msg`Birthday`)} 103 104 accessibilityHint={_(msg`Enter your birth date`)} 104 - maximumDate={new Date()} 105 + maximumDate={getDateAgo(13)} 105 106 /> 106 107 </View> 107 108
+11
src/lib/strings/time.ts
··· 20 20 } 21 21 22 22 /** 23 + * Get a Date object that is N years ago from now 24 + * @param years number of years 25 + * @returns Date object 26 + */ 27 + export function getDateAgo(years: number): Date { 28 + const date = new Date() 29 + date.setFullYear(date.getFullYear() - years) 30 + return date 31 + } 32 + 33 + /** 23 34 * Compares two dates by year, month, and day only 24 35 */ 25 36 export function simpleAreDatesEqual(a: Date, b: Date): boolean {