diff --git a/docs/package.json b/docs/package.json index 4ce6481a3b3e86..ecc62350ef0933 100644 --- a/docs/package.json +++ b/docs/package.json @@ -67,8 +67,6 @@ "core-js": "^2.6.11", "cross-env": "^7.0.3", "css-mediaquery": "^0.1.2", - "date-fns": "^2.30.0", - "date-fns-jalali": "^2.21.3-1", "dayjs": "^1.11.13", "feed": "^4.2.2", "fg-loadcss": "^3.1.0", diff --git a/docs/src/components/productX/XDateRangeDemo.tsx b/docs/src/components/productX/XDateRangeDemo.tsx index 8738087b6c6646..a1ccba8aa0ed72 100644 --- a/docs/src/components/productX/XDateRangeDemo.tsx +++ b/docs/src/components/productX/XDateRangeDemo.tsx @@ -7,25 +7,25 @@ import List from '@mui/material/List'; import ListItem from '@mui/material/ListItem'; import { StaticDateRangePicker } from '@mui/x-date-pickers-pro/StaticDateRangePicker'; import { PickersShortcutsItem, PickersShortcutsProps, DateRange } from '@mui/x-date-pickers-pro'; -import { AdapterDateFns } from '@mui/x-date-pickers/AdapterDateFns'; +import { AdapterDayjs } from '@mui/x-date-pickers/AdapterDayjs'; import { LocalizationProvider } from '@mui/x-date-pickers/LocalizationProvider'; import { HighlightedCode } from '@mui/docs/HighlightedCode'; -import { startOfWeek, endOfWeek, subDays } from 'date-fns'; +import dayjs, { Dayjs } from 'dayjs'; import Frame from 'docs/src/components/action/Frame'; -const startDate = new Date(); -startDate.setDate(10); -const endDate = new Date(); -endDate.setDate(endDate.getDate() + 28); +const startDate = dayjs(); +startDate.date(10); +const endDate = dayjs(); +endDate.date(endDate.date() + 28); -function CustomRangeShortcuts(props: PickersShortcutsProps>) { +function CustomRangeShortcuts(props: PickersShortcutsProps>) { const { items, onChange, isValid, changeImportance = 'accept' } = props; if (items == null || items.length === 0) { return null; } - const resolvedItems = items.map((item: PickersShortcutsItem>) => { + const resolvedItems = items.map((item: PickersShortcutsItem>) => { const newValue = item.getValue({ isValid }); return { @@ -80,25 +80,25 @@ const code = ` `; export default function XDateRangeDemo() { - const today = new Date(); - const shortcutsItems: PickersShortcutsItem>[] = [ + const today = dayjs(); + const shortcutsItems: PickersShortcutsItem>[] = [ { label: 'This Week', getValue: () => { - return [startOfWeek(today), endOfWeek(today)]; + return [today.startOf('week'), today.endOf('week')]; }, }, { label: 'Last Week', getValue: () => { - const prevWeek = subDays(today, 7); - return [startOfWeek(prevWeek), endOfWeek(prevWeek)]; + const prevWeek = today.add(-7, 'days'); + return [prevWeek.startOf('week'), prevWeek.endOf('week')]; }, }, { label: 'Last 7 Days', getValue: () => { - return [subDays(today, 7), today]; + return [today.add(-7, 'days'), today]; }, }, { label: 'Reset', getValue: () => [null, null] }, @@ -164,7 +164,7 @@ export default function XDateRangeDemo() { }), ]} > - + - + + = 0.4'} - date-fns-jalali@2.21.3-1: - resolution: {integrity: sha512-Sgw1IdgCgyWDKCpq6uwAu24vPMOtvmcXXXuETr1jQO/aVj4h23XAltcP7hLbo+osqoiJnPmiydbI/q1W7TYAjA==} - engines: {node: '>=0.11'} - date-fns@2.30.0: resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==} engines: {node: '>=0.11'} @@ -14939,13 +14929,13 @@ snapshots: transitivePeerDependencies: - '@types/react' - '@mui/x-date-pickers-pro@7.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@types/react@18.3.4)(react@18.3.1))(@mui/material@packages+mui-material+build)(@types/react@18.3.4)(date-fns-jalali@2.21.3-1)(date-fns@2.30.0)(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@mui/x-date-pickers-pro@7.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@types/react@18.3.4)(react@18.3.1))(@mui/material@packages+mui-material+build)(@types/react@18.3.4)(date-fns@2.30.0)(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@babel/runtime': 7.25.0 '@mui/material': link:packages/mui-material/build '@mui/system': 5.16.5(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@types/react@18.3.4)(react@18.3.1))(@types/react@18.3.4)(react@18.3.1) '@mui/utils': 5.16.5(@types/react@18.3.4)(react@18.3.1) - '@mui/x-date-pickers': 7.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@types/react@18.3.4)(react@18.3.1))(@mui/material@packages+mui-material+build)(@types/react@18.3.4)(date-fns-jalali@2.21.3-1)(date-fns@2.30.0)(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + '@mui/x-date-pickers': 7.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@types/react@18.3.4)(react@18.3.1))(@mui/material@packages+mui-material+build)(@types/react@18.3.4)(date-fns@2.30.0)(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@mui/x-license': 7.13.0(@types/react@18.3.4)(react@18.3.1) clsx: 2.1.1 prop-types: 15.8.1 @@ -14956,12 +14946,11 @@ snapshots: '@emotion/react': 11.13.3(@types/react@18.3.4)(react@18.3.1) '@emotion/styled': 11.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@types/react@18.3.4)(react@18.3.1) date-fns: 2.30.0 - date-fns-jalali: 2.21.3-1 dayjs: 1.11.13 transitivePeerDependencies: - '@types/react' - '@mui/x-date-pickers@7.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@types/react@18.3.4)(react@18.3.1))(@mui/material@packages+mui-material+build)(@types/react@18.3.4)(date-fns-jalali@2.21.3-1)(date-fns@2.30.0)(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': + '@mui/x-date-pickers@7.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@emotion/styled@11.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@types/react@18.3.4)(react@18.3.1))(@mui/material@packages+mui-material+build)(@types/react@18.3.4)(date-fns@2.30.0)(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1)': dependencies: '@babel/runtime': 7.25.0 '@mui/material': link:packages/mui-material/build @@ -14977,7 +14966,6 @@ snapshots: '@emotion/react': 11.13.3(@types/react@18.3.4)(react@18.3.1) '@emotion/styled': 11.13.0(@emotion/react@11.13.3(@types/react@18.3.4)(react@18.3.1))(@types/react@18.3.4)(react@18.3.1) date-fns: 2.30.0 - date-fns-jalali: 2.21.3-1 dayjs: 1.11.13 transitivePeerDependencies: - '@types/react' @@ -18387,8 +18375,6 @@ snapshots: es-errors: 1.3.0 is-data-view: 1.0.1 - date-fns-jalali@2.21.3-1: {} - date-fns@2.30.0: dependencies: '@babel/runtime': 7.25.0