diff --git a/packages/x-date-pickers/src/models/adapters.ts b/packages/x-date-pickers/src/models/adapters.ts index 68891ae41b0b2..17c58ab20d994 100644 --- a/packages/x-date-pickers/src/models/adapters.ts +++ b/packages/x-date-pickers/src/models/adapters.ts @@ -155,7 +155,7 @@ export type AdapterOptions = { locale?: TLocale; } & PropertyIfNotNever<'instance', TInstance>; -export type DateBuilderReturnType = T extends null +export type DateBuilderReturnType = [T] extends [null] ? null : TDate; diff --git a/test/utils/pickers/describeGregorianAdapter/testCalculations.ts b/test/utils/pickers/describeGregorianAdapter/testCalculations.ts index a8439902d70c0..90b8f60581e99 100644 --- a/test/utils/pickers/describeGregorianAdapter/testCalculations.ts +++ b/test/utils/pickers/describeGregorianAdapter/testCalculations.ts @@ -118,6 +118,12 @@ export const testCalculations: DescribeGregorianAdapterTestSuite = ({ ).to.be.lessThan(5); } }); + + it('should work without args', () => { + const date = adapter.date().valueOf(); + + expect(Math.abs(date - Date.now())).to.be.lessThan(5); + }); }); it('Method: getTimezone', () => {