From a9ee2df33a11919bbe0a394e49dd03ed55c4d7d9 Mon Sep 17 00:00:00 2001 From: Keane Chan Date: Sun, 9 Oct 2022 22:20:38 +0800 Subject: [PATCH] [portal][fix] convert number to Month type --- apps/portal/src/components/shared/MonthYearPicker.tsx | 2 +- apps/portal/src/pages/index.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/portal/src/components/shared/MonthYearPicker.tsx b/apps/portal/src/components/shared/MonthYearPicker.tsx index bb6539f1..bf000501 100644 --- a/apps/portal/src/components/shared/MonthYearPicker.tsx +++ b/apps/portal/src/components/shared/MonthYearPicker.tsx @@ -1,6 +1,6 @@ import { Select } from '@tih/ui'; -type Month = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; +export type Month = 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12; export type MonthYear = Readonly<{ month: Month; diff --git a/apps/portal/src/pages/index.tsx b/apps/portal/src/pages/index.tsx index 1a8a1b64..360c81e8 100644 --- a/apps/portal/src/pages/index.tsx +++ b/apps/portal/src/pages/index.tsx @@ -3,14 +3,14 @@ import type { TypeaheadOption } from '@tih/ui'; import { HorizontalDivider } from '@tih/ui'; import CompaniesTypeahead from '~/components/shared/CompaniesTypeahead'; -import type { MonthYear } from '~/components/shared/MonthYearPicker'; +import type { Month, MonthYear } from '~/components/shared/MonthYearPicker'; import MonthYearPicker from '~/components/shared/MonthYearPicker'; export default function HomePage() { const [selectedCompany, setSelectedCompany] = useState(null); const [monthYear, setMonthYear] = useState({ - month: new Date().getMonth() + 1, + month: (new Date().getMonth() + 1) as Month, year: new Date().getFullYear(), });