From eb0cb6177aaddcf7bf5c5cf87eb64aa06e37bd61 Mon Sep 17 00:00:00 2001 From: mai Date: Thu, 13 Jun 2024 12:33:27 +0700 Subject: [PATCH] feat: update start year on user's interest page --- .../mobile/src/app/(app)/user/details/[id].tsx | 5 +++-- frontend/mobile/src/consts/user-info.ts | 14 +++++++++++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/frontend/mobile/src/app/(app)/user/details/[id].tsx b/frontend/mobile/src/app/(app)/user/details/[id].tsx index 4687ab36..e2248035 100644 --- a/frontend/mobile/src/app/(app)/user/details/[id].tsx +++ b/frontend/mobile/src/app/(app)/user/details/[id].tsx @@ -16,7 +16,8 @@ import { COLLEGE, GRADUATION_CYCLE, MAJORS, - graduationYear + graduationYear, + startYear } from '@/src/consts/user-info'; import { UserInfoData } from '@/src/types/userInfo'; import { convertUserData } from '@/src/utils/userInfo'; @@ -181,7 +182,7 @@ const UserDetails = () => { onChange={onChange} placeholder="Select start year" title="Start Year" - data={graduationYear()} + data={startYear()} /> )} name="startYear" diff --git a/frontend/mobile/src/consts/user-info.ts b/frontend/mobile/src/consts/user-info.ts index d2f1bb8b..133437e9 100644 --- a/frontend/mobile/src/consts/user-info.ts +++ b/frontend/mobile/src/consts/user-info.ts @@ -19,7 +19,7 @@ export const GRADUATION_CYCLE: Item[] = [ export const graduationYear = () => { var year = new Date().getFullYear(); - const range = 5; + const range = 6; const graduationYears: Item[] = []; for (let i = 0; i < range; i++) { graduationYears.push({ @@ -30,6 +30,18 @@ export const graduationYear = () => { return graduationYears; }; +export const startYear = () => { + var year = new Date().getFullYear(); + const graduationYears: Item[] = []; + for (let i = 5; i >= 0; i--) { + graduationYears.push({ + key: String(year - i), + value: String(year - i) + }); + } + return graduationYears; +} + export const MAJORS: Item[] = [ { key: 'africanaStudies', value: 'Africana Studies' }, { key: 'americanSignLanguage', value: 'American Sign Language' },