[portal][fix] convert number to Month type

pull/344/head
Keane Chan 3 years ago
parent 66a931dc68
commit a9ee2df33a
No known key found for this signature in database
GPG Key ID: 32718398E1E9F87C

@ -1,6 +1,6 @@
import { Select } from '@tih/ui'; 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<{ export type MonthYear = Readonly<{
month: Month; month: Month;

@ -3,14 +3,14 @@ import type { TypeaheadOption } from '@tih/ui';
import { HorizontalDivider } from '@tih/ui'; import { HorizontalDivider } from '@tih/ui';
import CompaniesTypeahead from '~/components/shared/CompaniesTypeahead'; 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'; import MonthYearPicker from '~/components/shared/MonthYearPicker';
export default function HomePage() { export default function HomePage() {
const [selectedCompany, setSelectedCompany] = const [selectedCompany, setSelectedCompany] =
useState<TypeaheadOption | null>(null); useState<TypeaheadOption | null>(null);
const [monthYear, setMonthYear] = useState<MonthYear>({ const [monthYear, setMonthYear] = useState<MonthYear>({
month: new Date().getMonth() + 1, month: (new Date().getMonth() + 1) as Month,
year: new Date().getFullYear(), year: new Date().getFullYear(),
}); });

Loading…
Cancel
Save