build: moment -> date-fns로 대체

main
minuk926 3 years ago
parent f0da2f33c2
commit 874d26d56e

@ -11,6 +11,16 @@ core-js 버전 3.3 미만은 유지보수가 안되니 사용하지 말라
# npx yarn-audit-fix
```
### yarn install 실패시 : --force vs --legacy-peer-deps
```text
--force : 충돌 우회
--legacy-peer-deps : 충돌 무시
--force 시도 실패시 --legacy-peer-deps 실행
$ yarn install --force --network-timeout 6000000
```
### npm(yarn) install시 ECOCKETTIMEOUT 에러
```shell
npm(yarn) install --network-timeout 6000000
@ -20,7 +30,7 @@ npm
npm cache verify or npm cache clean --force
yarn
yarn cache clean
yarn cache clean --force
```
### useEffect, useMemo, useCallback lifeCycle
@ -71,4 +81,7 @@ useEffect(() => {
```text
useRef : 클래스로 치면 멤버변수 혹은 dom객체 처럼 특정한 '값'만 기억해야 할 때
useMemo : 복잡한 함수의 'retur값'을 기억해야 할 때
```
```
date-fns
moment

@ -28,7 +28,6 @@
"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",
@ -39,7 +38,6 @@
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"material-ui-popup-state": "^2.0.0",
"moment": "^2.29.1",
"prop-types": "^15.8.1",
"react": "^17.0.2",
"react-apexcharts": "^1.3.9",

@ -1,6 +1,9 @@
import { useCallback, useEffect, useMemo, useState } from 'react';
import _ from 'lodash';
import format from 'date-fns/format';
import getYear from 'date-fns/getYear';
// material-ui
import { GridActionsCellItem } from '@mui/x-data-grid';
@ -17,13 +20,16 @@ import MainCard from 'ui-component/cards/MainCard';
// project imports
import MuiGridList from 'ui-component/MuiGridList';
import opstBizService from 'apis/OpstBizService';
import moment from 'moment';
import { useTheme } from '@mui/material/styles';
import xitCmm from 'commons/XitCmm';
const ParkingReview = () => {
const theme = useTheme();
const toYear = Number(moment().format('YYYY'));
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);
const [selectedYear, setSelectedYear] = useState(toYear);

Loading…
Cancel
Save