From d178174259a7dcd02fdc84b37c796eece90e44fd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 30 Aug 2024 11:50:45 +0000 Subject: [PATCH 1/3] Bump date-fns to ^3.6.0 --- docs/package.json | 2 +- pnpm-lock.yaml | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/docs/package.json b/docs/package.json index 4ce6481a3b3e86..21bb7d8ab73d31 100644 --- a/docs/package.json +++ b/docs/package.json @@ -67,7 +67,7 @@ "core-js": "^2.6.11", "cross-env": "^7.0.3", "css-mediaquery": "^0.1.2", - "date-fns": "^2.30.0", + "date-fns": "^3.6.0", "date-fns-jalali": "^2.21.3-1", "dayjs": "^1.11.13", "feed": "^4.2.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a22a2750a0b748..024ee717ae9d0e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -633,10 +633,10 @@ importers: version: 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)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@mui/x-date-pickers': specifier: 7.13.0 - version: 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) + version: 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@3.6.0)(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@mui/x-date-pickers-pro': specifier: 7.13.0 - version: 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) + version: 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@3.6.0)(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@mui/x-license': specifier: 7.13.0 version: 7.13.0(@types/react@18.3.4)(react@18.3.1) @@ -689,8 +689,8 @@ importers: specifier: ^0.1.2 version: 0.1.2 date-fns: - specifier: ^2.30.0 - version: 2.30.0 + specifier: ^3.6.0 + version: 3.6.0 date-fns-jalali: specifier: ^2.21.3-1 version: 2.21.3-1 @@ -7008,6 +7008,9 @@ packages: resolution: {integrity: sha512-fnULvOpxnC5/Vg3NCiWelDsLiUc9bRwAPs/+LfTLNvetFCtCTN+yQz15C/fs4AwX1R9K5GLtLfn8QW+dWisaAw==} engines: {node: '>=0.11'} + date-fns@3.6.0: + resolution: {integrity: sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==} + date-format@4.0.13: resolution: {integrity: sha512-bnYCwf8Emc3pTD8pXnre+wfnjGtfi5ncMDKy7+cWZXbmRAsdWkOQHrfC1yz/KiwP5thDp2kCHWYWKBX4HP1hoQ==} engines: {node: '>=4.0'} @@ -14939,13 +14942,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-jalali@2.21.3-1)(date-fns@3.6.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-jalali@2.21.3-1)(date-fns@3.6.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 @@ -14955,13 +14958,13 @@ snapshots: optionalDependencies: '@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: 3.6.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-jalali@2.21.3-1)(date-fns@3.6.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 @@ -14976,7 +14979,7 @@ snapshots: optionalDependencies: '@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: 3.6.0 date-fns-jalali: 2.21.3-1 dayjs: 1.11.13 transitivePeerDependencies: @@ -18393,6 +18396,8 @@ snapshots: dependencies: '@babel/runtime': 7.25.0 + date-fns@3.6.0: {} + date-format@4.0.13: {} dateformat@3.0.3: {} From 14f3a47fc9f1bb5315d63e0595eab215d439ca8c Mon Sep 17 00:00:00 2001 From: Lukas Date: Fri, 30 Aug 2024 15:40:06 +0300 Subject: [PATCH 2/3] Refactor to use `AdapterDayjs` --- .../components/productX/XDateRangeDemo.tsx | 30 +++++++++---------- docs/src/components/productX/XHero.tsx | 13 ++++---- .../components/showcase/ThemeDatePicker.tsx | 4 +-- 3 files changed, 24 insertions(+), 23 deletions(-) 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() { }), ]} > - + - + + Date: Fri, 30 Aug 2024 15:52:28 +0300 Subject: [PATCH 3/3] Remove `date-fns` deps --- docs/package.json | 2 -- pnpm-lock.yaml | 33 +++++++-------------------------- 2 files changed, 7 insertions(+), 28 deletions(-) diff --git a/docs/package.json b/docs/package.json index 21bb7d8ab73d31..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": "^3.6.0", - "date-fns-jalali": "^2.21.3-1", "dayjs": "^1.11.13", "feed": "^4.2.2", "fg-loadcss": "^3.1.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 024ee717ae9d0e..eccec9a5909cfe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -633,10 +633,10 @@ importers: version: 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)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@mui/x-date-pickers': specifier: 7.13.0 - version: 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@3.6.0)(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 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-date-pickers-pro': specifier: 7.13.0 - version: 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@3.6.0)(dayjs@1.11.13)(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 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': specifier: 7.13.0 version: 7.13.0(@types/react@18.3.4)(react@18.3.1) @@ -688,12 +688,6 @@ importers: css-mediaquery: specifier: ^0.1.2 version: 0.1.2 - date-fns: - specifier: ^3.6.0 - version: 3.6.0 - date-fns-jalali: - specifier: ^2.21.3-1 - version: 2.21.3-1 dayjs: specifier: ^1.11.13 version: 1.11.13 @@ -7000,17 +6994,10 @@ packages: resolution: {integrity: sha512-t/Ygsytq+R995EJ5PZlD4Cu56sWa8InXySaViRzw9apusqsOO2bQP+SbYzAhR0pFKoB+43lYy8rWban9JSuXnA==} engines: {node: '>= 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'} - date-fns@3.6.0: - resolution: {integrity: sha512-fRHTG8g/Gif+kSh50gaGEdToemgfj74aRX3swtiouboip5JDLAyDE9F11nHMIcvOaXeOC6D7SpNhi7uFyB7Uww==} - date-format@4.0.13: resolution: {integrity: sha512-bnYCwf8Emc3pTD8pXnre+wfnjGtfi5ncMDKy7+cWZXbmRAsdWkOQHrfC1yz/KiwP5thDp2kCHWYWKBX4HP1hoQ==} engines: {node: '>=4.0'} @@ -14942,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@3.6.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@3.6.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 @@ -14958,13 +14945,12 @@ snapshots: optionalDependencies: '@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: 3.6.0 - date-fns-jalali: 2.21.3-1 + date-fns: 2.30.0 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@3.6.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 @@ -14979,8 +14965,7 @@ snapshots: optionalDependencies: '@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: 3.6.0 - date-fns-jalali: 2.21.3-1 + date-fns: 2.30.0 dayjs: 1.11.13 transitivePeerDependencies: - '@types/react' @@ -18390,14 +18375,10 @@ 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 - date-fns@3.6.0: {} - date-format@4.0.13: {} dateformat@3.0.3: {}