diff --git a/core/src/components/datetime/datetime.tsx b/core/src/components/datetime/datetime.tsx index f36cd66718d..ab9939504ae 100644 --- a/core/src/components/datetime/datetime.tsx +++ b/core/src/components/datetime/datetime.tsx @@ -8,6 +8,7 @@ import { isRTL } from '@utils/rtl'; import { createColorClasses } from '@utils/theme'; import { caretDownSharp, caretUpSharp, chevronBack, chevronDown, chevronForward } from 'ionicons/icons'; +import { config } from '../../global/config'; import { getIonMode } from '../../global/ionic-global'; import type { Color, Mode, StyleEventDetail } from '../../interface'; @@ -1555,10 +1556,11 @@ export class Datetime implements ComponentInterface { const left = (nextMonth as HTMLElement).offsetWidth * 2; + const scrollMode = config.getBoolean('animated', true) ? 'smooth' : 'instant'; calendarBodyRef.scrollTo({ top: 0, left: left * (isRTL(this.el) ? -1 : 1), - behavior: 'smooth', + behavior: scrollMode, }); }; @@ -1575,10 +1577,11 @@ export class Datetime implements ComponentInterface { const left = (prevMonth as HTMLElement).offsetWidth * 2; + const scrollMode = config.getBoolean('animated', true) ? 'smooth' : 'instant'; calendarBodyRef.scrollTo({ top: 0, left: left * (isRTL(this.el) ? 1 : -1), - behavior: 'smooth', + behavior: scrollMode, }); };