diff --git a/README.md b/README.md index 388a96b..dd8af0b 100755 --- a/README.md +++ b/README.md @@ -82,6 +82,12 @@ useEffect(() => { useRef : 클래스로 치면 멤버변수 혹은 dom객체 처럼 특정한 '값'만 기억해야 할 때 useMemo : 복잡한 함수의 'retur값'을 기억해야 할 때 ``` +### typeof : primitive type string return vs instanceof +```js +'undefined' | 'boolean' | 'number' | 'string' | 'object' | 'function' -date-fns -moment \ No newline at end of file +typeof 변수명 +typeof 변수명 === 'object' + +변수명 instanceof 클래스 +``` \ No newline at end of file diff --git a/package.json b/package.json index 61e02aa..c64322e 100755 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "chance": "^1.1.8", "core-js": "^3", "csstype": "^3.0.10", + "date-fns": "^2.28.0", "draft-js": "^0.11.7", "emoji-picker-react": "^3.5.1", "formik": "^2.2.9", diff --git a/src/views/biz/parking/Review.jsx b/src/views/biz/parking/Review.jsx index 435219a..2de8ba3 100644 --- a/src/views/biz/parking/Review.jsx +++ b/src/views/biz/parking/Review.jsx @@ -4,7 +4,6 @@ import _ from 'lodash'; import format from 'date-fns/format'; import getYear from 'date-fns/getYear'; - // material-ui import { GridActionsCellItem } from '@mui/x-data-grid'; import { Divider, Grid, InputAdornment, MenuItem, OutlinedInput, Select } from '@mui/material'; @@ -26,13 +25,10 @@ import xitCmm from 'commons/XitCmm'; const ParkingReview = () => { const theme = useTheme(); const year = getYear(new Date()); - console.log(`year = ${year}`); - console.log(year instanceof Date); - const toYear = Number(year); - console.log(`toYear = ${toYear}`); - const years = _.range(toYear, toYear - 14, -1); + console.log(typeof year); + const years = _.range(year, year - 14, -1); - const [selectedYear, setSelectedYear] = useState(toYear); + const [selectedYear, setSelectedYear] = useState(year); const [searchTxt, setSearchTxt] = useState(''); const [totalCount, setTotalCount] = useState(0); @@ -138,7 +134,7 @@ const ParkingReview = () => { - setSelectedYear(e.target.value)}> {years.map((year, idx) => ( {year}