Datepicker: correctly default to the current year
This commit is contained in:
parent
2bc620016e
commit
1f616c0a44
|
@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Fixed
|
### Fixed
|
||||||
- Layout: use accent color for "floating action button" (mobile compose button).
|
- Layout: use accent color for "floating action button" (mobile compose button).
|
||||||
- ServiceWorker: don't serve favicon, robots.txt, and others from ServiceWorker.
|
- ServiceWorker: don't serve favicon, robots.txt, and others from ServiceWorker.
|
||||||
|
- Datepicker: correctly default to the current year.
|
||||||
|
|
||||||
## [3.0.0] - 2022-12-25
|
## [3.0.0] - 2022-12-25
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ const Datepicker = ({ onChange }: IDatepicker) => {
|
||||||
|
|
||||||
const [month, setMonth] = useState<number>(new Date().getMonth());
|
const [month, setMonth] = useState<number>(new Date().getMonth());
|
||||||
const [day, setDay] = useState<number>(new Date().getDate());
|
const [day, setDay] = useState<number>(new Date().getDate());
|
||||||
const [year, setYear] = useState<number>(2022);
|
const [year, setYear] = useState<number>(new Date().getFullYear());
|
||||||
|
|
||||||
const numberOfDays = useMemo(() => {
|
const numberOfDays = useMemo(() => {
|
||||||
return getDaysInMonth(month, year);
|
return getDaysInMonth(month, year);
|
||||||
|
|
Loading…
Reference in New Issue