diff --git a/packages/x-date-pickers/src/AdapterLuxon/AdapterLuxon.ts b/packages/x-date-pickers/src/AdapterLuxon/AdapterLuxon.ts index 295db06c32f41..0118a0025be80 100644 --- a/packages/x-date-pickers/src/AdapterLuxon/AdapterLuxon.ts +++ b/packages/x-date-pickers/src/AdapterLuxon/AdapterLuxon.ts @@ -324,8 +324,8 @@ export class AdapterLuxon implements MuiPickersAdapter { public isWithinRange = (value: DateTime, [start, end]: [DateTime, DateTime]) => { return ( - value.equals(start) || - value.equals(end) || + this.isEqual(value, start) || + this.isEqual(value, end) || (this.isAfter(value, start) && this.isBefore(value, end)) ); }; diff --git a/test/utils/pickers/describeGregorianAdapter/testCalculations.ts b/test/utils/pickers/describeGregorianAdapter/testCalculations.ts index e27fc0f3b458a..a8439902d70c0 100644 --- a/test/utils/pickers/describeGregorianAdapter/testCalculations.ts +++ b/test/utils/pickers/describeGregorianAdapter/testCalculations.ts @@ -577,7 +577,7 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ ).to.equal(false); }); - it('should use inclusivity of range', () => { + it('should use inclusiveness of range', () => { expect( adapter.isWithinRange(adapter.date('2019-09-01T00:00:00.000Z')!, [ adapter.date('2019-09-01T00:00:00.000Z')!, @@ -606,6 +606,15 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ ]), ).to.equal(true); }); + + it('should be equal with values in different locales', () => { + expect( + adapter.isWithinRange(adapter.date('2022-04-17'), [ + adapterFr.date('2022-04-17'), + adapterFr.date('2022-04-19'), + ]), + ).to.equal(true); + }); }); it('Method: startOfYear', () => {